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由别人提供,不能更改,所以比较困惑。

解决方案 »

  1.   

    应该不会吧!    
    如:
             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;
     
      

  2.   

    typedef int (* tcpinitDLL)(long);
    换成typedef int (__stdcal* tcpinitDLL)(long);test
      

  3.   

    调用约定不一致的问题~用typedef int (__stdcall* tcpinitDLL)(long);试试~
      

  4.   

    调用约定不同,堆栈清除了两次,看看
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/_core_Argument_Passing_and_Naming_Conventions.asp
      

  5.   

    typedef int (WINAPI *tcpinitDLL)(long);
    API函数调用时要跳到一个转向表,
    也就是IMPORT表
    在这里才是执行真正的函数地址
      

  6.   

    在WIN32下__thiscall与WINAPI是一样的
      

  7.   

    typedef int (__stdcall* tcpinitDLL)(long);
      

  8.   

    依我看,应该是调用函数中读写地址的问题,很有可能在DLL中。
      

  9.   

    你要知道他的DLL中用的是什么约定啊,约定不同typedef中是不同的