Debug与Release版本的库正常是不能混用的,混用之后,大概率会出现堆异常或者其它未知错误,具体原因也不是很清楚,查阅资料也是了解了大致情况,没有更深入的剖析,比较了解的可以推荐一下,下面这段话是网上查阅的

If you have an EXE and a DLL.
When your exe APP was built Debug Mode, your Dll must be Debug mode. 
When your exe APP was built Release Mode, your Dll must be Release mode. 
If exe is Release Mode and Dll is Debug Mode, Error. 
If exe is Debug Mode and Dll is Release Mode, Error.

-------------------------------- Why? --------------------------------
Looks like you have a problem with memory allocation.
When an application is built in debug mode it does not allocate memory from the same heap as it does in release mode.(have a look to the definition of new and delete operator, and also to malloc (in afxmem.h ? (not sure just grep it))
Thus, when you get some memory from your debug app and give this memory to your release dll for processing and FREEING,you get an error since the realase dll tries to free it from the wrong heap. So always use your app and dll in the same mode. 
At least, do not try to free memory allocation in one mode in the other mode.

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐