[Patch] gethostbyname2

Corinna Vinschen corinna-cygwin@cygwin.com
Thu Feb 26 09:52:00 GMT 2009

On Feb 25 23:03, Pierre A. Humblet wrote:
> I tried to compile Exim with IPv6 enabled and Cygwin 1.7, but it needs 
> gethostbyname2.
> Here is an implementation of that function.
> In attachment I am including the same patch as well as a short test function.
> Pierre
> 2009-02-25  Pierre Humblet <Pierre.Humblet@ieee.org>
> 	* net.cc: Include windns.h.
> 	(gethostbyname2): New function.
> 	* cygwin.din: Export gethostbyname2.

This is way cool!  I have this function on my TODO list for ages.

But there's a problem.  You're using DnsQuery_A directly, but this
function only exists since Win2K.  Would it be a big problem to rework
the function to use the resolver functions instead?  They are part of
Cygwin now anyway and that would abstract gethostbyname2 from the
underlying OS capabilities.

The implications of having this function... for instance, we can
implement gethostbyname then in terms of gethostbyname2 and honor
the RES_USE_INET6 flag.  We could even drop relying on the Winsock
implementation of getaddrinfo/getnameinfo and use the Stevens
implementation exclusively.  Wow.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

More information about the Cygwin-patches mailing list