[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mingw32 and sockets

From: Simon Josefsson
Subject: mingw32 and sockets
Date: Wed, 21 Sep 2005 23:34:11 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

Mingw32 doesn't have sys/types.h, arpa/inet.h or netinet/in.h.  But if
you include winsock2.h instead of those three header files, most (?)
POSIX socket functions work.

The simplest solutions would be to replace:

#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>


#include "glsocket.h"

or something, and glsocket.h does the right thing.  But I don't like
that, including the POSIX headers in my application is more readable.

Would it be possible to create those three POSIX header files if they
don't exist on the system, and if winsock2.h do exist?  The created
files would simply #include <winsock2.h>.  Creating them would be done
like getopt_.h and others.  The complication is that this has to be
done in a sub-directory somehow, so that #include for sys/socket.h

What do you think?

Perhaps this should be considered a mingw32 bug instead?  Problem is
this mingw32 cross compiler will likely be around for a while, since
it is shipped with the latest Debian release..  So it might be useful
to support even if it is broken.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]