Unauthorized external character due to name change

I encountered a linker error for the XERCES function when updating it from 2.6 to 2.8

unresolved external symbol ( ?resolveEntity@HandlerBase @ xercesc_2_8@ @ UAEPAVInputSource@2 @ QBG0@Z ) 

I checked xerces-c_2.8.lib and found that the lib name is slightly different from the one in my .obj file. As shown

 ?resolveEntity@HandlerBase @ xercesc_2_8@ @ UAEPAVInputSource@2 @ QB_W0@Z 

So, I understand that the linker will not find a match and will not make a mistake.

But I can not understand why my .obj file contains a different signature.

The code includes the correct header and lib files from the still invalid name.

Any help would be appreciated.

+4
source share
2 answers

You can use the undname.exe utility to restore the original C ++ declaration.

? resolveEntity @HandlerBase @ xercesc_2_8 @@ UAEPAVInputSource @ 2 @ QBG0 @Z converts to:

 virtual class xercesc_2_8::InputSource * __thiscall xercesc_2_8::HandlerBase::resolveEntity( unsigned short const * const, unsigned short const * const) 

? resolveEntity @HandlerBase @ xercesc_2_8 @@ UAEPAVInputSource @ 2 @ QB_W0 @Z converts to:

 virtual class xercesc_2_8::InputSource * __thiscall xercesc_2_8::HandlerBase::resolveEntity( wchar_t const * const, wchar_t const * const) 

Note the differences in argument types, unsigned short vs wchar_t . For some reason, your compiler does not recognize the wchar_t type. This may be due to the fact that you have a very old compiler. Or it may be the wrong option, in msvc it is C / C ++, Language, "Treat wchar_t as a built-in type". Or you have a macro that processes unsigned string type.

+13
source

C ++ allows function overloading, so function parameters are written to the name mangling. you can try to call a function with different types of parameters than the DLL expects.

Make sure your header file matches the version of your DLL.

0
source

Source: https://habr.com/ru/post/1436806/


All Articles