Results 1 to 3 of 3

Thread: Delphi and C++

  1. #1

    Delphi and C++

    Is there a way i can include a C/C++ file(s) or header file(s) in a Delphi project, and these files use each other's declarations, types and functions?

    example :

    c_unit.cpp :

    Code:
    int Funct(int a)
    {
     int res;
     // code
     return res * G_Var;
    }
    p_unit.pas :

    Code:
    Const G_Var = $10;
    
    Procedure test;
    Begin
     For a := 0 To 5 Do
      Begin
       WriteLn(Funct(a));
      End;
    End;

  2. #2

    Delphi and C++

    Only in C++ Builder
    From brazil (:

    Pascal pownz!

  3. #3

    Delphi and C++

    There are ways, but they aren't simple
    Like arthurprs said: It is not possible to use C++ code inlined in delphi code.

    You can use a C++ compiler to compile your C++ code into an
    object. Then you can link this object with your pascal-program
    (there are some tutorials how you do that with freepascal, if I remember
    correctly).

    The other way is compiling a shared library with C++ (.so or .dll). Then
    you can use this library in Pascal (either dynamically or via "external").

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •