summaryrefslogtreecommitdiff
path: root/win32/include
diff options
context:
space:
mode:
authorJan Dubois <jand@activestate.com>2010-11-25 12:23:05 -0800
committerJan Dubois <jand@activestate.com>2010-11-25 14:23:05 -0800
commit41ed632ef2f96ef1cd60c4ad0dba5a29ba54e27e (patch)
treebd4a59a4ac9d305c3e0bbdc5fac9f69b6dd9ba2a /win32/include
parent2a25d7b6d65a21dbe54445c03edf63eb4efa6aff (diff)
downloadperl-41ed632ef2f96ef1cd60c4ad0dba5a29ba54e27e.tar.gz
Include ws2tcpip.h to get IPv6 definitions
This commit also moves down the 'extern "C"' wrapper so that it doesn't apply to any #included headers because they may generate C++ code (templates) which doesn't confirm to "C" linkage (when this header is included in C++ mode, e.g. while compiling win32/perllib.c).
Diffstat (limited to 'win32/include')
-rw-r--r--win32/include/sys/socket.h22
1 files changed, 15 insertions, 7 deletions
diff --git a/win32/include/sys/socket.h b/win32/include/sys/socket.h
index 03b60e2bb9..d551d4bab7 100644
--- a/win32/include/sys/socket.h
+++ b/win32/include/sys/socket.h
@@ -6,29 +6,37 @@
#ifndef _INC_SYS_SOCKET
#define _INC_SYS_SOCKET
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#define WIN32_LEAN_AND_MEAN
#ifdef __GNUC__
# define Win32_Winsock
#endif
#include <windows.h>
-
/* Too late to include winsock2.h if winsock.h has already been loaded */
#ifndef _WINSOCKAPI_
# if defined(UNDER_CE) && UNDER_CE <= 300
/* winsock2 only for 4.00+ */
# include <winsock.h>
# else
-# include <winsock2.h>
-#endif
+# include <winsock2.h>
+ /* We need to include ws2tcpip.h to get the IPv6 definitions.
+ * It will in turn include wspiapi.h. Later versions of that
+ * header in the Windows SDK generate C++ template code that
+ * can't be compiled with VC6 anymore. The _WSPIAPI_COUNTOF
+ * definition below prevents wspiapi.h from generating this
+ * incompatible code.
+ */
+# define _WSPIAPI_COUNTOF(_Array) (sizeof(_Array) / sizeof(_Array[0]))
+# include <ws2tcpip.h>
+# endif
#endif
#include "win32.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#ifndef ENOTSOCK
#define ENOTSOCK WSAENOTSOCK
#endif