GNOME Bugzilla – Bug 638650
Fix windows unicode build
Last modified: 2012-08-13 10:05:38 UTC
Created attachment 177475 [details] [review] Patch Fix windows unicode build
Ah, something like that was heavily debated on the past an the suggested change is simply not a good idea it seems, see the following thread: http://mail.gnome.org/archives/xml/2008-February/msg00094.html there was a suggestion of a solution but it seems that we are stuck, unless guessing the encoding of the string and calling the right function, but I'm not sure of the appropriate mechanism to use. Daniel
Review of attachment 177475 [details] [review]: Can't apply as is, this will break on non UNICODE then :-(
(In reply to comment #2) > Review of attachment 177475 [details] [review]: > > Can't apply as is, this will break on non UNICODE then :-( I don't think so! ;-) Here the relevant part from winbase.h: WINBASEAPI __out_opt HMODULE WINAPI LoadLibraryA( __in LPCSTR lpLibFileName ); WINBASEAPI __out_opt HMODULE WINAPI LoadLibraryW( __in LPCWSTR lpLibFileName ); #ifdef UNICODE #define LoadLibrary LoadLibraryW #else #define LoadLibrary LoadLibraryA #endif // !UNICODE You see that depending on the UNICODE define LoadLibrary resolves to LoadLibraryA or LoadLibraryW. The LoadLibrarA function takes one char* parameter, where LoadLibraryW takes wchar_t*. Since xmlModulePlatformOpen _always_ has a char* parameter, it will compile only with LoadLibraryA. AFAIK an implicit conversion from char* to wchar_t does not happen. ;-)
Okay, after much discussions in the list: https://mail.gnome.org/archives/xml/2012-May/msg00062.html the simpler is to go that way, but document the limitation at the API level. thanks, Daniel