MSYS and MSYS2 differ in the tricks to include both windows.h and winsock2.h, use __MINGW32_VERSION to differentiate them

This commit is contained in:
Riccardo Mottola 2020-06-05 16:32:55 +02:00
parent 5bbe378a79
commit 6ab0e3465f

View file

@ -306,8 +306,18 @@ typedef struct {
#define WINVER Windows2000 #define WINVER Windows2000
#endif #endif
// Trick to distinguish between MSYS/MinGW and MSYS2/MinGW32, the latter defines
// __MINGW32_MAJOR_VERSION and __MINGW32_MINOR_VERSION for compatibility
// but to a lower version than older MSYS/MinGW, but not the compound version
//
#if defined(__MINGW32_VERSION)
#define __USE_W32_SOCKETS
#include <windows.h>
#include <winsock2.h>
#else
#include <winsock2.h> #include <winsock2.h>
#include <windows.h> #include <windows.h>
#endif
#undef __OBJC_BOOL #undef __OBJC_BOOL
#undef BOOL #undef BOOL