现在有一CBC做的DLL,我在程序中调用的时候出错了,请帮我看看HMODULY hModuly=LoadLibrary("dllname.dll");
FARPROC proc=GetProcAddress(hModule,"Proc1");
if(proc==NULL) return 0;
typedef HANDLE (* FUNC)();
FUNC proc1=(FUNC)proc;
HANDLE re=proc1();
//上面代码没问题
FARPROC proc2=GetProcAddress(hModule,"Proc2");
if(proc2==NULL) return 0;
typedef int (* FUNC2)(HANDLE);
FUNC2 proc3=(FUNC2)proc2;
int re2=proc3(hWnd);
//调用proc3的时候出错!
编译没错,运行时出错!error code:
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 copnvention with a function pointer declared with a
different calling convention.
FARPROC proc=GetProcAddress(hModule,"Proc1");
if(proc==NULL) return 0;
typedef HANDLE (* FUNC)();
FUNC proc1=(FUNC)proc;
HANDLE re=proc1();
//上面代码没问题
FARPROC proc2=GetProcAddress(hModule,"Proc2");
if(proc2==NULL) return 0;
typedef int (* FUNC2)(HANDLE);
FUNC2 proc3=(FUNC2)proc2;
int re2=proc3(hWnd);
//调用proc3的时候出错!
编译没错,运行时出错!error code:
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 copnvention with a function pointer declared with a
different calling convention.
解决方案 »
- 关于WritePrivateProfileString的参数?
- 关于软件换肤的认识问题?
- 如何实现模拟登录网站发信?
- 如何去除画图的背景
- 请问怎样做一个可执行程序,自动输入加密程序的密码
- 如何删除一个已经生成的派生类?
- 如何在release下单步执行(F10)?
- 最近写了一个多用户拨号程序,有需要源码的留下email.
- Jedi(杰迪) 清关注
- 通过ADO技术访问SQL SERVER数据库
- 类似于VB或Delphi控件的表格属性窗是怎么实现的,VC的控件属性窗又是怎么做出来的?
- 我用CreateFile打开了并口,用的是读写两种访问方式,再用ReadFile和WriteFile读写数据时,程序就会进入没反应状态,要强行关闭,估计是
DWORD (WINAPI *fn)(DWORD,DWORD);//你的函数原型
if(hInst)
{
fn=(DWORD(WINAPI(DWORD,DWORD))::GetProcAddress((HMODULE)hInst,("Proc1"));
if(fn)
(*fn)(param1,param2);
::FreeLibrary (hInst);
return true;
}
声明要改为 int (* __stdcall FUNC2)(HANDLE);
如果还不是,把连接选项去掉试试/GZ
改成
int re2=(*proc3)(hWnd);