调用DLL弹出The value of ESP was not properly saved across a function call

像这种错误一般是由于C++回调函数声明引起的,在声明回调函数指针的时候,使用

typedef void (*RecvMessage)(const char* msgContent);

只要将声明加上一个回调定义就可以了__stdcall,如下

#ifdef WIN32
	typedef void (__stdcall *RecvMessage)(const char* msgContent);
#else
	typedef void (*RecvMessage)(const char* msgContent);
#endif

这样就可以解决了。

Comments are closed.