cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Unresolved Curl_ipv4_resolve_r with USE_IPV6=1

From: Thorsten Schöning <tschoening_at_am-soft.de>
Date: Thu, 1 Oct 2015 12:59:22 +0200

Guten Tag Daniel Stenberg,
am Donnerstag, 1. Oktober 2015 um 00:27 schrieben Sie:

> Yes. You should set the defines based on what compiler you use and what
> functions you have with it.

Doing this doesn't seem to be enough for me: If I don't define
_WIN32_WINNT myself, it's done by some included Windows headers
automatically, which lead to automatically defining struct pollfd as
well, but without cURL knowing and trying to do the same, which
results in a compile time error.

In my opinion it's best to take the approach with defining
_WIN32_WINNT automatically in config-win32.h, like is done with
MSC_VER and POCC. This way I get HAVE_GETADDRINFO and its friends and
cURL recognizes it for HAVE_STRUCT_POLLFD as well.

I've attached a patch. What do you think? Is erroring out a good idea?
I'm not sure which Windows SDKs where shipped with older versions of
the compiler, I'm pretty sure it was at least Windows 2000 and XP for
the oldest version BCB 5 and BCB 6, so could lower the bar to that. Or
we wait until someone complains and lower the bar then. I prefer the
compile time error instead of silently doing nothing, because that way
I would have known what's wrong and could think about it without
bothering you. ;-)

> Index: config-win32.h
> ===================================================================
> --- config-win32.h (Revision 4088)
> +++ config-win32.h (Arbeitskopie)
> @@ -575,6 +575,24 @@
> # endif
> #endif
>
> +/* __BORLANDC__ seems to always end up having _WIN32_WINNT defined, in the end,
> + system wide headers may do it automatically. Doing it early makes checks for
> + different headers, functions and such easier. */
> +#if defined(__BORLANDC__) && !defined(_WIN32_WINNT)
> +# // XE4+ supports at least Windows 7.
> +# if __BORLANDC__ >= 0x0660
> +# define _WIN32_WINNT 0x0601
> +# // XE+ supports at least Windows XP.
> +# elif __BORLANDC__ >= 0x0630
> +# define _WIN32_WINNT 0x0501
> +# elif
> +# error _WIN32_WINNT should be defined early!
> +# endif
> +#endif
> +#if defined(__BORLANDC__) && !defined(WINVER)
> +# define WINVER _WIN32_WINNT
> +#endif
> +
> /* Availability of freeaddrinfo, getaddrinfo and getnameinfo functions is
> quite convoluted, compiler dependent and even build target dependent. */
> #if defined(HAVE_WS2TCPIP_H)

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning       E-Mail: Thorsten.Schoening_at_AM-SoFT.de
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/
Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04
AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2015-10-01