用vb写了个dll(mydll.dll),其中有个export 的函数是
Public Function FunA(
a As Integer,
b As Integer
) As Long我用vc编程调用这个函数,
HINSTANCE hDll=NULL, \\1
hDll=::LoadLibrary("mydll.dll"); \\2
typedef long (*pFun)(int a ,int b ); \\3
pFun Fun =(pMTAPIConnect)::GetProcAddress(hDll,"FunA"); \\4 long asd=0; \\5
asd=Fun(1,1); \\6就在最后一步第六步 asd=Fun(1,1); 的时候出错了,调试的时候,前面 1-5部都正确,加载dll文件也成功,hdll也成功的分配到了地址,得到函数的地址也没有问题,就是在最后一部出错了,报错的提示是:
The value of ESP wan not properly saved across a function call, This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention我想我C里面的声明并没有错啊!
请高手赐教!
另外,不是我不想给分啊,我实在是没有什么分了! 谢谢摆脱了!@@@@@@!!!!!!!
Public Function FunA(
a As Integer,
b As Integer
) As Long我用vc编程调用这个函数,
HINSTANCE hDll=NULL, \\1
hDll=::LoadLibrary("mydll.dll"); \\2
typedef long (*pFun)(int a ,int b ); \\3
pFun Fun =(pMTAPIConnect)::GetProcAddress(hDll,"FunA"); \\4 long asd=0; \\5
asd=Fun(1,1); \\6就在最后一步第六步 asd=Fun(1,1); 的时候出错了,调试的时候,前面 1-5部都正确,加载dll文件也成功,hdll也成功的分配到了地址,得到函数的地址也没有问题,就是在最后一部出错了,报错的提示是:
The value of ESP wan not properly saved across a function call, This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention我想我C里面的声明并没有错啊!
请高手赐教!
另外,不是我不想给分啊,我实在是没有什么分了! 谢谢摆脱了!@@@@@@!!!!!!!
typedef long (__stdcall *pFun)(int a, int b);
或者
typedef long (WINAPI *pFun)(int a, int b);
VB.net也不能导出函数的。
VB.net也不能导出函数的。楼上~~~~~~~~~~~~
你直接说VB不能导出函数不就行了?
另外想问一下3楼的,__cdecl 和 WINAPI 有为什么不同吗?