On 16 June 2011 12:14, Steven McCoy <[email protected]> wrote: > I really would like to find Microsoft's official verdict on _WINSOCKAPI_ and > hence the preferred mechanism for handling *winsock2.h*. Currently there > is the hack from Microsoft listed previously which is incompatible with * > mingw-w64* as that raises an assertion saying you must manually include > first. > > Ok, the choices as enumerated here: http://stronglib.blogspot.com/
*#1 Include winsock2.h before windows.h* #include <winsock2.h> #include <windows.h> Works fine as expected but you cannot catch the Windows version if you wanted to target NT 3.5. *#2 Use WIN32_LEAN_AND_MEAN which bypasses WinSock in windows.h* #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <winsock2.h> Works great. *#3 Use _WINSOCKAPI_ before windows.h* #define _WINSOCKAPI_ #include <windows.h> #include <winsock2.h> Only appears a valid solution for MSVC and bails out on MinGW-w64: /usr/x86_64-w64-mingw32/sys-root/mingw/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h So it looks like #2 is the way to go but I don't have NT 3.5 to verify apart from matching the existing code. I guess one can test by forcing the WINVER globally and see if the headers won't bail out. -- Steve-o
_______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
