cURL / Mailing Lists / curl-library / Single Mail


RE: removing winsock 2 dependence

From: David Byron <>
Date: Thu, 26 Feb 2004 17:15:48 -0800

On Thu, 26 Feb 2004, Dominick Meglio wrote:

> Correct me if I'm wrong, but won't this break IPv6 support
> under Windows that was added by a previous patch? I'm 99%
> sure that IPv6 requires winsock2.

I wouldn't be surprised if you're right. I've never built using IPv6, nor
do I have a way of testing it.

To build with IPv6, do I just

#define ENABLE_IPV6

at the top of lib/setup.h? It doesn't seem that way because when I do that,
I get:

.\ftp.c(173) : error C2065: 'socklen_t' : undeclared identifier

which leads me back to this code in config-win32.h that I suppose may need
some more munging.

/* Define this to 'int' if socklen_t is not an available typedefed type */
#if !defined(ENABLE_IPV6) && ((_MSC_VER < 1300) || !defined(USE_SSLEAY))
#define socklen_t int

I tried removing the !defined(ENABLE_IPV6) part and got a bit farther.
After what I found out below, I don't think this matters so much.

The next thing I ran into is:

.\ftp.c(1067) : error C2065: 'NI_MAXHOST' : undeclared identifier

After a bit of creative grepping, it appears NI_MAXHOST is defined in the
ws2tcpip.h that comes with MSVC 7 but not with MSVC 6. So, I'd like to add
a line somewhere (probably config-win32.h) that says

#if defined(ENABLE_IPV6) && (_MSC_VER < 1300)
#error "IPv6 requires MSVC 7"

Assuming I can get this to build, and that IPv6 requires winsock2, I see a
couple of things to do:

1. In win32_init in lib/easy.c, ask for either 1.1 or 2.0 depending on #if
2. If we really do need to link to ws2_32.lib (which I'm not sure of yet,
and kind of doubt), we need to put ENABLE_IPV6 in the Makefile instead of
setup.h or elsewhere and then special case the link line appropriately.

I think the other changes are fine to stay as they are. It's a bit of
overkill, but it doesn't hurt. If IPv6 really does require linking with
ws2_32.lib, I can special case the code in telnet.c to reference the
functions directly instead of dynamically loading it. I'll find that out
soon enough....


Received on 2004-02-27