Re: [xml] LoadLibrary needs to be LoadLibraryA


> When I tried to compile libxml on Windows along with my application that is built with 'UNICODE' defined (i.e. as a Unicode
> application rather than as an "ANSI" application),  I came across a problem in xmlmodule.c.


> With UNICODE defined, LoadLibrary is resolved to LoadLibraryW which expects to get 'const wchar_t*' rather than 'const char*'.
> To avoid the problem,  we have to use LoadLibraryA explicitly.  


> Below is my trivial patch:

I agree that the explicitely stating LoadLibraryA or LoadLibraryW would be best.
But IMHO LoadLibraryA would be a bad idea. This would not allow to load modules
located in pathes containing unicode characters.

IMHO interpreting the path as utf-8 and then converting it to wchar would be better
and then trying LoadLibraryW(). If the path cannot be converted or LoadLibraryW()
fails a second attempt can be made using the original argument of the xmlModulePlatformOpen
function passed to LoadLibraryA(). For the utf-8 -> wchar thingy there is already code
in xmlIO.c doing these things it should be recycled here.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]