After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 638650 - Fix windows unicode build
Fix windows unicode build
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
git master
Other Windows
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2011-01-04 12:45 UTC by Patrick R. Gansterer
Modified: 2012-08-13 10:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch (910 bytes, patch)
2011-01-04 12:45 UTC, Patrick R. Gansterer
needs-work Details | Review

Description Patrick R. Gansterer 2011-01-04 12:45:00 UTC
Created attachment 177475 [details] [review]
Patch

Fix windows unicode build
Comment 1 Daniel Veillard 2012-05-10 14:41:55 UTC
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
Comment 2 Daniel Veillard 2012-05-10 14:58:01 UTC
Review of attachment 177475 [details] [review]:

Can't apply as is, this will break on non UNICODE then :-(
Comment 3 Patrick R. Gansterer 2012-05-10 16:37:59 UTC
(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. ;-)
Comment 4 Daniel Veillard 2012-08-13 10:05:38 UTC
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