program
module
file: i386\chkesp.c
line:42the value of ESP was not properly saved acorss a function call.
This is usually a result of calling a functino declared with
one calling convention with a function pointer declared with a
different calling convention由于DLL由别人提供,不能更改,所以比较困惑。
module
file: i386\chkesp.c
line:42the value of ESP was not properly saved acorss a function call.
This is usually a result of calling a functino declared with
one calling convention with a function pointer declared with a
different calling convention由于DLL由别人提供,不能更改,所以比较困惑。
如:
typedef int (* tcpinitDLL)(long);
HINSTANCE hmod; hmod = ::LoadLibrary("htpapi");
if (hmod ==NULL)
{
AfxMessageBox("load htpapi.dll Fail!");
return;
} tcpinitDLL lpproc;
lpproc = (tcpinitDLL)GetProcAddress(hmod, "TcpInit"); if (lpproc != (tcpinitDLL)NULL)
{
long in = 6; int iret = (*lpproc)(in); //出错的地方
if (iret != 0)
{
FreeLibrary(hmod);
return;
}
}
else
{
FreeLibrary(hmod);
return;
}
FreeLibrary(hmod);
return;
换成typedef int (__stdcal* tcpinitDLL)(long);test
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/_core_Argument_Passing_and_Naming_Conventions.asp
API函数调用时要跳到一个转向表,
也就是IMPORT表
在这里才是执行真正的函数地址