Longstanding __USE_W32_SOCKETS hiccup.

Corinna Vinschen corinna-cygwin@cygwin.com
Fri Aug 7 19:47:00 GMT 2009

On Aug  7 15:11, Christopher Faylor wrote:
> On Fri, Aug 07, 2009 at 07:50:51PM +0100, Dave Korn wrote:
> >Corinna Vinschen wrote:
> >> On Aug  7 18:08, Dave Korn wrote:
> >>> Christopher Faylor wrote:
> >>>
> >>>> I haven't been paying close attention here but why are we bothering to
> >>>> accommodate use of winsock2.h and time.h.  This is really only for
> >>>> Cygwin itself right?
> >>>   Nope.
> >>>
> >>>> Otherwise, I don't think we should worry about people trying to mix
> >>>> winsock.h in true Cygwin programs.
> >>>   It seems to have worked well enough for GNAT in gcc-4.3.2 and earlier, but GCC
> >>> HEAD has undergone some sort of refactoring that means we now get a duplicate
> >>> definition of timeval during compilation of libada.  This is aimed at fixing
> >>> that problem.
> >> 
> >> Why is libada including winsock2.h when being build for Cygwin?  That's
> >> a bug.
> >
> >  No, it's by design.  For some reason, presumably historical, the ada compiler
> >is a hybrid of cyg and ming.  It works well enough using winsock sockets; the
> >only bug is that it doesn't use __USE_W32_SOCKETS while doing so.  Previously it
> >got away with it by luck, now it doesn't.
> It's still a bug.

I concur wholeheartedly.  Using winsock from libada instead of Cygwin's
POSIX socket API will result in bastard ada applications without their
knowledge.  And they won't be able to do anything about it.

For instance, all the changes I made to support IPv6 in a POSIXy manner
will be invisible to ADA applications.  ioctl information doesn't match
the info known to other Cygwin applications, thus breaking interaction
with non-Ada applications.  getifaddrs and stuff like that are entirely
unavailable.  Even older functionality like getpeereid will not be
available to Ada applications.

This is 100% a bug.  There's no good design reason to circumvent the
POSIX socket API provided by Cygwin for a CYgwin library which will
be linked against all applications written in this language.


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

More information about the Cygwin-developers mailing list