dll导出类:成员函数中存在string类型导致编译报错 _acrt_first_block == header

根本原因:对象在析构时不正确的释放内存导致。

std::string是STL中定义的模板类,所以编译器在编译动态库时会将std::string实例化,在编译exe时也会将其实例化,也就是说有两套std::string实例代码分别在exe和dll中.

//实例:
//动态库中
bool MyDebug::FlyWriteString(string explain)
//改为:
bool MyDebug::FlyWriteString(string &explain)
//注意:如果函数体中有临时string对象同样应避免
原文地址:https://www.cnblogs.com/youhao1999/p/15137315.html