cURL / Mailing Lists / curl-library / Single Mail


Re: VS2008 build issues

From: Ruslan Gazizov <>
Date: Thu, 08 Apr 2010 23:32:07 +0400

* Daniel Stenberg <> [Thu, 8 Apr 2010 20:09:52 +0200
> It seems it's just another case of a messy system.
> getaddrinfo() is only present in some systems and compilers, so for
> those that
> have getaddrinfo() I figure a different lib is needed than for those
> systems
> that don't have getaddrinfo()...
> So, I have no good suggestion on how to solve this other than perhaps
> use
> cmake for the windows build.
I agree about messy ;-). Yet I think I have a solution. For these
(get|free)addrinfo, a great info is in the MSDN article -

The getaddrinfo function was added to the Ws2_32.dll on Windows XP and
later. If you want to execute an application using this function on
earlier versions of Windows (Windows 2000, Windows NT, and Windows
Me/98/95), then you need to include the Ws2tcpip.h file and also include
the Wspiapi.h file. When the Wspiapi.h include file is added, the
getaddrinfo function is defined to the WspiapiGetAddrInfo inline
function in the Wspiapi.h file. At runtime, the WspiapiGetAddrInfo
function is implemented in such a way that if the Ws2_32.dll or the
Wship6.dll (the file containing getaddrinfo in the IPv6 Technology
Preview for Windows 2000) does not include getaddrinfo, then a version
of getaddrinfo is implemented inline based on code in the Wspiapi.h
header file. This inline code will be used on older Windows platforms
that do not natively support the getaddrinfo function.

So, for modern Windowses starting with XP all these switches in setup.h
and config-win32.h will result in
#include <winsock2.h>
#include <ws2tcpip.h>
So, clearly we will then have to link to ws2_32.dll.
For older Windowses it can be implemented as recommended in the MSDN
Still I do not understand how anyone could have built libcurl in say XP
using wsock32.lib. Maybe they had some preprocessor workarounds in their
List admin:
Received on 2010-04-08