Hello all!
I want to be able to use C++ and Delphi/FreePascal (in Delphi Mode) for a project of mine. I'll use dll files to handle the communication between the languages.
Anyway after I compiled a dll with FreePascal the application crashed. It worked fine when compiling with Delphi, but that's not good enough for me since I want it to work with both compilers.
Here's a small example which shows what doesn't work:
C++
Pascal:Code:// in *.h typedef class IMyClass { public: __cdecl virtual void DoSomething()=0; } *lpMyClass; typedef class CMySub: public IMyClass { public: __cdecl void DoSomething(); }; // in *.cpp __cdecl void CMySub::DoSomething() { printf("hello world\n"); };
[pascal]
// MyClass.pas
type
IMyClass = class(TObject)
public
procedure DoSomething; virtual; cdecl; abstract;
end;
// pasdll.dpr
procedure InitDll(MyClass: IMyClass); cdecl;
begin
MyClass.DoSomething;
end;
exports
InitDll name 'InitDll';
[/pascal]
And some extra code for initializing everything.
Any ideas on how to get things working with FreePascal?
Bookmarks