cpp.cpp
extern "C"
char* GetText()
{
return "Hello, world!";
}
delphi.dpr
{$APPTYPE CONSOLE}
{$LINK 'cpp.obj'}
function _GetText: PChar; cdecl; external;
begin
WriteLn(_GetText);
end.
I can't get this to work, no matter what. I tried various calling conventions playing with underscores. even creating a .c wrapper for the .cpp code (but then the .c wrapper does not "see" any .cpp characters). I am going to refuse and use DLLs. Any suggestions?
source
share