因为vc6重要使用线程池,我便使用LoadLibrary将QueueUserWorkItem函数导入,然后启动一个线程函数thr1。问题是在thr1执行完毕返回时出现警告对话框“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 delared with a different convention.”这是什么问题,请大虾指导。

解决方案 »

  1.   

    这指的是ESP寄存器的值没有被正确保存,通常是因为你调用的动态库函数非法访问内存地址,或者是你的函数声明与动态库的函数声明不符。这会导致即使链接成功,在运行时,也会出现Access Violation错误
      

  2.   

    函数调用的错误,多半因为参数约定不对,比如__stdcall生命,而用_declspec调用