Re: [Mingw-users] windows.h dependency
- Date: Sun, 3 Feb 2008 10:47:23 -0500
- From: NightStrike <nightstrike@xxxxxxxxx>
- Subject: Re: [Mingw-users] windows.h dependency
On 2/3/08, Roumen Petrov <bugtrack@xxxxxxxxxxxxxxxxx> wrote:
> As is pointed before a program may include other header first that
> include windows.h.
Every header should be protected against multiple inclusion. If it's
not, that's a bug. The point is that dependencies of a header should
be resolved by the header, and not the user of the header.
> For sockets in particular it is winsock2.h or ws2tcpip.h for winsock 2.
> If program include windows.h first the result is winsock 1.1.
> Mingw w32api must not resolve this.
#if defined(__USE_W32_SOCKETS) || !(defined(__CYGWIN__) ||
defined(__MSYS__) || defined(_UWIN))
#if (_WIN32_WINNT >= 0x0400)
#include <winsock2.h>
/*
* MS likes to include mswsock.h here as well,
* but that can cause undefined symbols if
* winsock2.h is included before windows.h
*/
#else
#include <winsock.h>
#endif /* (_WIN32_WINNT >= 0x0400) */
Looks like the default is based on the proper criteria, and not a
blanket "include windows.h, get winsock 1"
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users