From b6e3dcc799a6750a78172ee060ab0af2384a4a3a Mon Sep 17 00:00:00 2001 From: Luis Lavena Date: Wed, 25 Apr 2012 04:06:06 +0200 Subject: [PATCH] Windows: actually detect mingw-w64 and not 64 bits mode __MINGW64__ is only defined when using mingw-w64 in 64bits mode, not when using the 32bits version of the compiler. Instead, to detect usage of mingw-w64 instead of mingw version of GCC we should look at __MINGW64_VERSION_MAJOR and __MINGW64_VERSION_MINOR. If one of these is defined means we are running on mingw-w64 compiler and headers and not mingw.org build. Read more here: http://bit.ly/detect-mingw-w64-vs-mingw Closes #384 --- src/win/winapi.h | 6 +++--- src/win/winsock.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/win/winapi.h b/src/win/winapi.h index df840d5d..073b9e8c 100644 --- a/src/win/winapi.h +++ b/src/win/winapi.h @@ -4079,8 +4079,8 @@ (FACILITY_NTWIN32 << 16) | ERROR_SEVERITY_WARNING))) /* from ntifs.h */ -/* MinGW already has it */ -#if defined(_MSC_VER) || defined(__MINGW64__) +/* MinGW already has it, mingw-w64 does not. */ +#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR) typedef struct _REPARSE_DATA_BUFFER { ULONG ReparseTag; USHORT ReparseDataLength; @@ -4335,7 +4335,7 @@ typedef NTSTATUS (NTAPI *sNtSetInformationFile) # define SYMBOLIC_LINK_FLAG_DIRECTORY 0x1 #endif -#ifdef __MINGW32__ +#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) typedef struct _OVERLAPPED_ENTRY { ULONG_PTR lpCompletionKey; LPOVERLAPPED lpOverlapped; diff --git a/src/win/winsock.h b/src/win/winsock.h index 79b9e6b2..d070d580 100644 --- a/src/win/winsock.h +++ b/src/win/winsock.h @@ -112,7 +112,7 @@ typedef struct _AFD_RECV_INFO { #define IOCTL_AFD_RECEIVE_DATAGRAM \ _AFD_CONTROL_CODE(AFD_RECEIVE_DATAGRAM, METHOD_NEITHER) -#if defined(__MINGW32__) && !defined(__MINGW64__) +#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) typedef struct _IP_ADAPTER_UNICAST_ADDRESS_XP { /* FIXME: __C89_NAMELESS was removed */