libexpat 动态加载问题

libexpat 动态加载问题

linux9.0 用dlopen,动态加载函数XmlParse(),能成功被加载,但是访问core dump ,很是奇怪,错误点在memmove....,实在没有办法,只能直接连接到libexpat.so,直接用XmlParse而没有任何问题,很是奇怪
libexpat.dll在windows下动态加载无任何问题
所以只能改写:

 1 NVXML_INLINE
 2 bool     NVXmlTree::Init_XmlLib( const   char   *  libexpat) {    
 3#ifdef WIN32
 4    if ( !_xml_dll.LoadDll(libexpat)){
 5        return false;    
 6    }
    
 7    _xmlf.XML_Parse= (NV_XML_Parse)_xml_dll.LoadSymbol("XML_Parse");    
 8    _xmlf.XML_ParserCreate = (NV_XML_ParserCreate)_xml_dll.LoadSymbol("XML_ParserCreate");    
 9    _xmlf.XML_ParserFree=(NV_XML_ParserFree)_xml_dll.LoadSymbol("XML_ParserFree");
10    _xmlf.XML_SetElementHandler=(NV_XML_SetElementHandler)_xml_dll.LoadSymbol("XML_SetElementHandler");
11    _xmlf.XML_SetUserData = (NV_XML_SetUserData)_xml_dll.LoadSymbol("XML_SetUserData");        
12    _xmlf.XML_SetEncoding = (NV_XML_SetEncoding) _xml_dll.LoadSymbol("XML_SetEncoding");    
13    _xmlf.XML_SetCharacterDataHandler = (NV_XML_SetCharacterDataHandler)
14                            _xml_dll.LoadSymbol("XML_SetCharacterDataHandler");    
15#endif
16#ifdef _UNIX
17//-- on unix,using expat api directly
18    _xmlf.XML_Parse= (NV_XML_Parse)XML_Parse;    
19    _xmlf.XML_ParserCreate = (NV_XML_ParserCreate)XML_ParserCreate;    
20    _xmlf.XML_ParserFree=(NV_XML_ParserFree)XML_ParserFree;
21    _xmlf.XML_SetElementHandler=(NV_XML_SetElementHandler)XML_SetElementHandler;
22    _xmlf.XML_SetUserData = (NV_XML_SetUserData)XML_SetUserData;        
23    _xmlf.XML_SetEncoding = (NV_XML_SetEncoding)XML_SetEncoding;    
24    _xmlf.XML_SetCharacterDataHandler = (NV_XML_SetCharacterDataHandler)XML_SetCharacterDataHandler;    
25
26#endif
27    return true;
28}
    

你可能感兴趣的:(libexpat 动态加载问题)