收录查询

[转]LoadLibrary()和_declspec(dllexport)

我用vc的appwizard做了一个基于mfc regular,dynamic link to mfc的dll框架,
在里面写了一个函数:
int _stdcall  MyFunc1(int i)
{
   return i;
}
然后在.def文件中输出了它。
但是当我在用vc程序中用loadlibrary的时候,却出现了下面的错误:
debug error!
the value of esp was not properly saved across 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.
我的client测试程序是这么写的:
typedef int (* MYFUNC)(int);MYFUNC myfunc1;
if (!(m_hInst=::LoadLibrary("mydll.dll"))) return;
if(!(myfunc1=(MYFUNC)GetProcAddress(m_hInst,"MyFunc1"))) return ;
myfunc1(1);//执行到此处出错。
因为我想用在其它语言中调用该dll,所以不能用_declspec(dllexport).
请问大家又什么办法吗?多谢了!
posted @ 2006-09-25 18:12  ->  阅读(1092)  评论(1)    收藏  举报