我用vc++中写的一个简单的dll,但在delphi中调用时总是出现找不到入口点的错误,我用delphi写了相同的dll,调用时就没有任何问题。函数声明为:
function add (x:integer;y:integer):integer;stdcall;external 'math.dll'调用为: Total := add(a,b)函数声明变为:
function add (x:integer;y:integer):integer;cdecl;external 'math.dll'
function add (x:integer;y:integer):integer;safecall;external 'math.dll'
也不可以。为什么?
function add (x:integer;y:integer):integer;stdcall;external 'math.dll'调用为: Total := add(a,b)函数声明变为:
function add (x:integer;y:integer):integer;cdecl;external 'math.dll'
function add (x:integer;y:integer):integer;safecall;external 'math.dll'
也不可以。为什么?
需要用
D:\program files\Borland\CBuilder5\Bin\coff2omf.exe
转换一下。不知道是否可用来解决你这个问题。
没有问题,我就这样写,
检查一下您的math.dll里有没有输出add函数(def文件中有没有add函数)。
//function addition(x:real;y:real):real;stdcall;external 'testdll.dll' name 'firstdll'
function add(x:integer;y:integer):integer;stdcall;external 'math.dll'
//function add (x:integer;y:integer):integer;cdecl;external 'math.dll'
//function add (x:integer;y:integer):integer;safecall;external 'math.dll'这是VC中函数的定义:
MATH_API int _stdcall add(int x, int y)
{
int z = x + y ; return z ;}
格式
EXPORTS
函数名
函数名
...
写完之后加到工程里就可以了用VC自带的Depends工具可以看到DLL输出的函数名