summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2011-03-26 23:21:03 +0000
committerChris Wilson <chris+github@qwirx.com>2011-03-26 23:21:03 +0000
commit3991c90bb2d60a5811be90ea88f05e72e5d0d559 (patch)
tree200025b5b02a6b5e7a9c7dc3ce47af9d7d32c6c3
parent75a82376d157379f91cb353f6f0a135c88b3dddc (diff)
Define WINVER and _WIN32_WINNT to Windows 2000 to avoid importing WSAPoll
from winsock2.h, which conflicts with our definition of struct pollfd, on Windows Vista and above.
-rw-r--r--lib/win32/emu.h32
1 files changed, 29 insertions, 3 deletions
diff --git a/lib/win32/emu.h b/lib/win32/emu.h
index f3389590..1b071f7e 100644
--- a/lib/win32/emu.h
+++ b/lib/win32/emu.h
@@ -50,6 +50,23 @@
#define __MSVCRT_VERSION__ 0x0601
#endif
+// WIN32_WINNT versions 0x0600 (Vista) and higher enable WSAPoll() in
+// winsock2.h, whose struct pollfd conflicts with ours below, so for
+// now we just set it lower than that, to Windows 2000.
+#ifdef WINVER
+ #if WINVER != 0x0500
+ #error Must include emu.h before setting WINVER
+ #endif
+#endif
+#define WINVER 0x0500
+
+#ifdef _WIN32_WINNT
+ #if _WIN32_WINNT != 0x0500
+ #error Must include emu.h before setting _WIN32_WINNT
+ #endif
+#endif
+#define _WIN32_WINNT 0x0500
+
// Windows headers
#include <winsock2.h>
@@ -286,9 +303,18 @@ inline unsigned int sleep(unsigned int secs)
}
#define INFTIM -1
-#define POLLIN 0x1
-#define POLLERR 0x8
-#define POLLOUT 0x4
+
+#ifndef POLLIN
+# define POLLIN 0x1
+#endif
+
+#ifndef POLLERR
+# define POLLERR 0x8
+#endif
+
+#ifndef POLLOUT
+# define POLLOUT 0x4
+#endif
#define SHUT_RDWR SD_BOTH
#define SHUT_RD SD_RECEIVE