win+mingw+libxml2试用笔记

1,对于编译提示_imp__xmlFree错误的问题,igor给出的方法

在libxml/xmlexports.h中 105L,注释掉原有的预定义

 1 #if defined(_WIN32) && defined(__MINGW32__)
 2   #define XMLPUBFUN
 3   #ifdef __cplusplus
 4     #define XMLPUBVAR extern
 5   #else
 6     #define XMLPUBVAR
 7   #endif
 8   #if !defined _REENTRANT
 9     #define _REENTRANT
10   #endif
11 #endif

2,crash的问题,在调用dll前加入代码

if(!xmlFree) xmlMemGet(&xmlFree,&xmlMalloc,&xmlRealloc,NULL);

参考文章:

http://blog.csdn.net/king_on/article/details/7543577

https://mail.gnome.org/archives/xml/2004-February/msg00007.html

http://www.linuxquestions.org/questions/programming-9/%5Bsolved%5Dusing-libxml2-on-mingw-xmlfree-crashes-839802/

原文地址:https://www.cnblogs.com/jhaohai/p/3081675.html