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 try. I tried various calling conventions, playing with underscores. even creating a .c wrapper for the .cpp code (but then the .c wrapper doesn't "see" any .cpp symbols). I'm about to give up and use DLLs. Any suggestions?