我写了一个dll程序(regular DLL),在一个以对话框为主的project中使用这个dll,在使用中dll被正确的连接,也得到了所要调用的函数的地址,在所调用函数返回的时候出现了问题:
The value of ESP was 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.
请问各位高手这是什么原因造成的,我该如何解决。谢谢了!
The value of ESP was 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.
请问各位高手这是什么原因造成的,我该如何解决。谢谢了!
cdcel.
我在dll的函数实现中加了AFX_MANAGE_STATE(AfxGetStaticModuleState());
在我的project中我用的是显式连接。
另外请问我是否需要在dll的函数实现中这样的操作
extern "C" _declspec(dllexpot) int my_Max(int a, int b)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
if(a>=b)
return a;
else
return b;
}
{
if(a>=b)
return a;
else
return b;
}
That's OK!
Dont'Forget extern "c"!!.........
typedef int (*MyMax)(int ,int);
MyMax pF_MyMax;
pF_MyMax=(MyMax)GetProcAddress("my_Max");