Re: [xml] LoadLibrary needs to be LoadLibraryA





2008/2/19, Jungshik Shin <jshin1987 gmail com>:
Hi,

 
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:

 
-----------------Cut---------Here------------------------

--- xmlmodule.c.old
+++ xmlmodule.c 
@@ -300,7 +300,7 @@
 static void *
 xmlModulePlatformOpen(const char *name)
 {
-    return LoadLibraryA(name);
+    return LoadLibrary(name);
 }

 
------------------------------------------


Ooops. I took the patch backward. It should read 

--------------------------------------------
--- xmlmodule.c.old
+++ xmlmodule.c 
@@ -300,7 +300,7 @@
 static void *
 xmlModulePlatformOpen(const char *name)
 {
-    return LoadLibrary(name);
+    return LoadLibraryA(name);
 }

-------------------------------------
 
By explicitly calling LoadLibraryA, we can avoid a compilation error whether UNICODE is defined or not. 

Jungshik

Thank you,

 
Jungshik

 



--
ÃÃÅÃrÃÃÅÃÃÃÃÄÃÅÃÅÃÃÃ ììì, çææ

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