Re: [xml] The issue around LoadLibrary on Windows




Am 23.07.2012 um 16:23 schrieb Earnie Boyd:

On Wed, May 23, 2012 at 8:30 AM, Patrick Gansterer wrote:
On Wed, 23 May 2012 14:16:48 +0200, Bjoern Hoehrmann wrote:

* Daniel Veillard wrote:

C.f. the bug Fix windows unicode build
https://bugzilla.gnome.org/show_bug.cgi?id=638650

and the previous discussions here:

http://mail.gnome.org/archives/xml/2008-February/msg00094.html

now that the release is done, can we have a final decision on this.
As I understand it, LoadLibraryW takes a wchar_t* parameter, while
internally we are using only a char * (or xmlChar *) so it makes
no sense to try to call LoadLibraryW, and instead of using the
macro LoadLibrary which can only break build, calling LoadLibraryA
seems to be the simplest.


It is not clear to me that building libxml2 with UNICODE defined is a
sound idea if libxml2 is not designed for that


Since it's not designed for UNICODE builds it should ignore the UNICODE
define. But it doesn't at the moment, because the define is used indirectly
by LoadLibrary and GetProcAddress.
Ignoring would allow "UNICODE applications" which need to compile libxml2 in
their project too, adding the UNICODE define for the whole project and don't
need to undefine it for the libxml2 part.

How would that "ignore the UNICODE" work?  Defining UNICODE will cause
the API to do different things.

The API does the _same_ thing! There is only a difference which function get called
LoadLibraryA vs. LoadLibraryW. Since it only works with LoadLibraryA only, we can
write LoadLibraryA instead of LoadLibraryW directly. Using the functions directly
"ignores" the UNICODE define (since it's not used any more).

-- Patrick




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