delphi的unit "use_c.pas"源代码:
{*****************************************************}
unit use_c;
interface
implementationfunction GetGlobalValue: integer;
  stdcall;
  external;
{$L cuse.obj}end.
{*****************************************************}cpp文件"cuse.cpp"的源代码:
{*****************************************************}
int iGlobal = 0;
extern "C" int _stdcall GetGlobalValue(void)
  {return iGlobal;}
{*****************************************************}
delphi版本7.0,c++编译器为bcc32 5.5.1(borland的freecommandtool)
命令行为
bcc32 -c cuse.cpp
delphi报Unsatisfied forward or external declaration: 'GetGlobalValue'的错
如果把cuse.cpp名字换成cuse.c
bcc32 -c cuse.c
delphi就能编译成功tdump两个obj文件可以发现
1、使用cpp为的编译结果是
0000A7 COMDEF
    Name:  1: 'GetGlobalValue'      virtual(_TEXT) Length: 000a bytes
0000BD PUBDEF  '_iGlobal'              Segment: _DATA:0000
2、使用cpp为的编译结果是
0000A1 PUBDEF  '_iGlobal'              Segment: _DATA:0000
0000B3 PUBDEF  'GetGlobalValue'        Segment: _TEXT:0000这个就搞不懂了,尝试了bcc32的多个编译选项,依然不能成功。关键的希望能用cpp编译的obj