有一个dll(aaa.dll) 中的函数:deal。函数说明是:deal(字符串1,字符串2,字符串3),返回值同字符串3。字符串1和2是传入字符串,字符串3是返回值。没有aaa.lib,所以我在vc60中用load方法加载dll文件。如下:
type def LPTSTR (* _pfun)(LPCTSTR P1,LPCTSTR P2,LPTSTR P3);
_pfun fun;
LoadDll()具体函数名忘记了,但是加载dll是成功的。
执行:
fun(p1,p2,p3);
但是执行报错:The value of ESP can not saved across function calling.this is the result
of calling a function declared with a calling convention different with calling convention.
高手看看是哪里错了?
type def LPTSTR (* _pfun)(LPCTSTR P1,LPCTSTR P2,LPTSTR P3);
_pfun fun;
LoadDll()具体函数名忘记了,但是加载dll是成功的。
执行:
fun(p1,p2,p3);
但是执行报错:The value of ESP can not saved across function calling.this is the result
of calling a function declared with a calling convention different with calling convention.
高手看看是哪里错了?
使用动态加载的应用程序必须使用 LoadLibrary() 函数加载 DLL 并得到一个模块句柄。然后使用该句柄调用 GetProcAddress() 函数获得所需调用的导出函数的指针,并通过该指针调用 DLL 中的导出函数
=========================
getprocAddress正确。得到了函数地址。可是执行时报错。这个动态库可以由vb、c++调用,是不是字符串类型应是 BSTR 或 lpwstr?我试了bstr,好像不成。
fncptr=(fp_RegServProc)::GetProcAddress(hModule, "DLL函数");
if (fncptr!=NULL)
(*fncptr)(函数参数);