C/C++代码 ·

Run-Time Check Failure #0 – 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 declared with a different calling convention.

动态调用dll函数的时候,提示Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call.  错误:Run-Time Check Failure #0 - 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 declared with a different calling convention.

原因:因为调用的dll采用的是_stdcall调用方式,c++默认是使用的_declspec导致,

修改指针函数为_stdcall . typedef int(_stdcall * DLLFUNC)(int ,int);