[fpc-devel] Linking to C++

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Mon Jan 22 22:18:11 CET 2007


Maybe the compiler could hide the
procedurization/re-object-orientation, thus making interfacing easier.

So this:

type
 User = class
 public
   function Sum(a, b: cint): cint; cdecl; external 'cpplib.dll';
 end;

Would be the exact equivalent of:

function User_Sum(Self: Pointer; a, b: cint): cint; cdecl; external
'cpplib.dll' name '_ZN4User3SumEii';

type
 User = class
 private
    InternalHandle: Pointer;
 public
   function Sum(a, b: cint): cint; cdecl;
 end;

function User.Sum(a, b: cint): cint;
begin
  Result := User_Sum(InternalHandle, a, b);
end;

-- 
Felipe Monteiro de Carvalho



More information about the fpc-devel mailing list