Re: [xml] win32 getaddrinfo



Michael Stahl wrote:
Rob Richards wrote:
Michael Stahl wrote:
Rob Richards wrote:
</snip>
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.
I get it now and thought that was only an issue with VS 2008. Can you try building from SVN or even a snapshot. The lib was added just after the .31 release.

ok, i have built a snapshot (downloaded friday iirc). building works, and the dll is linked against ws2_32.dll.

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.
If the build from SVN fixes the initial problem, can you try using it on w Win2K machine? It's possible that the patch might not be needed though after more research I have doubts. I'm looking around here for an old OS to test on as well. I'm pretty sure I have an old VM image lying around here somewhere.

so today i finally got access to a win2k machine. the result:
with 2.6.31+my patch, the application runs.
with the snapshot, the application fails to run, and displays a message box complaining that ws2_32.dll could not be found.

so, i would suggest you revert the patch that introduced linking to ws2_32.dll, and use wspapi.h instead.

regards
michael


Michael,
If "my patch" is you patch first posted to the list I think that you understand that patch break libxml2 build on other platforms. Is you "suggestion" to broke libxml2 intentional ?


Rob,
may be the problem can be resolved with this proof of concept code:
do {
  /* resolve getaddrinfo at run time instead at compile time */
  h  = LoadLibraryA("ws2_32");
  if (h != NULL) {
    f = GetProcAddress(h, "getaddrinfo");
    if (f == NULL) {
      FreeLibrary(h);
      h = NULL;
    } else {
      /* */
    }
  }
  h  = LoadLibraryA("wship6");
  if (h != NULL) {
    f = GetProcAddress(h, "getaddrinfo");
    if (f == NULL) {
      FreeLibrary(h);
      h = NULL;
    } else {
      call f ....
    }
  }
  /* fail-back to gethostbyname */
  ....
} while (0);


As I understand wship6 is not default on platforms before nt 5.1.

Roumen



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