Re: [xml] win32 getaddrinfo



Rob Richards wrote:
Hi Michael,

Michael Stahl wrote:
Rob Richards wrote:
Michael Stahl wrote:
Daniel Veillard wrote:
On Tue, Apr 01, 2008 at 10:23:56AM +0200, Michael Stahl wrote:
Roumen Petrov wrote:
to quote the msdn documentation:


The freeaddrinfo function was added to the Ws2_32.dll on Windows XP and later.
[...]
When the Wspiapi.h include file is added, the freeaddrinfo function is defined to the WspiapiFreeAddrInfo inline function in the Wspiapi.h file.
the question is how do you detect that + #include <Wspiapi.h> /* for getaddrinfo, freeaddrinfo */ is actually available ? What about older version, WinCE ...
I guess this need some expert review (I'm not one for any Win stuff !)
me neither, i just quote msdn :)


Header  
Declared in Ws2tcpip.h on Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Declared in Ws2tcpip.h on Windows 2000, Windows NT, and Windows Me/98/95; include Wspiapi.h.


so, it says nothing about wince, but everything else from msft seems to have it.


What are you compiling with? The use of getaddrinfo actually came about due to an issue with win98.
http://bugzilla.gnome.org/show_bug.cgi?id=317431

I'm curious to know how HAVE_GETADDRINFO ended up getting defined.
from a quick grep, this seems to be defined in include/wsockcompat.h
that should be no surprise, as getaddrinfo is (afaik) actually defined in Ws2_32.dll on my build box; the error i had originally occured when _linking_.
however, that dll is only available on NT 5.1 (XP) or newer.

cl.exe says:

Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86

not that i have any clue about the setup, i just type "build" and fix what breaks :)
actually i'm compiling on a newer version of NT, let me see, it says:
Windows Server 2003 R2

but the result should run on win 2000 as well, which does not have the Ws2_32.dll; according to msdn "Wspiapi.h" should work in that case as well. hmm, maybe i should test if it actually runs, if i can find a win 2000 box around here...

michael
I think I finally understand what you are trying to do. You are building on Win 2003 with VS 2005 and then trying to use the lib on on Win2K or lower and it is there that it is failing to link?

well, it fails to link with vs 2005 already because libxml (using 2.6.31 here) is not linked against ws2_32.dll, so ld (or whatever msft calls its equivalent) complained that getaddrinfo and freeaddrinfo are undefined symbols.

Can you try the following patch?
Index: wsockcompat.h
===================================================================
--- wsockcompat.h    (revision 3721)
+++ wsockcompat.h    (working copy)
@@ -21,6 +21,7 @@
/* Check if ws2tcpip.h is a recent version which provides getaddrinfo() */
 #if defined(GetAddrInfo)
+#include <wspiapi.h>
 #define HAVE_GETADDRINFO
 #endif
 #endif

ah yes, that seems to work fine here, and is obviously the cleaner way to do it.

I don't want to change the behavior for those using VC6, so only include

uhm, there are still people who have to use that pile of junk? ouch...
well i hope at least they don't use its c++ "implementation"...

the header if GetAddrInfo is detected. I still need to double check this on a VS 200x build, but believe it should resolve the issue.

Rob

michael


--
"C makes it easy to shoot yourself in the foot; C++ makes it harder,
 but when you do it blows your whole leg off." -- Bjarne Stroustrup




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