Date added/modified: 23 Aug 2000
Look up the keyword "Obj files, calling" in Delphi help. If you try it, it doesn't work.
I found that it only works with C modules. Here is an example:
TESTC.C file
#include
void _stdcall _export showAMessage(char *msg) {
MessageBox(NULL, msg, "obj test", MB_OK);
}
PAS file code, partial
{$L testc.obj}
procedure showAMessage(s: pchar); stdcall; external;
procedure TForm1.Button1Click(Sender: TObject);
begin
showAMessage(pchar('It worked!'));
end;
I added testc.c to a C++ builder project and compiled. Then, I used it in a Delphi 5 PAS file as above. It works!
But, if I make it into a testc.cpp module then it doesn't work even if I add extern "C" to the declaration.