From 1bb9a9368b72d7cde85b2072ff2a802cf9e090cf Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sat, 16 May 2020 12:41:26 -0500 Subject: [PATCH] Make sure winsock2.h is included before windows.h This should be true in the normal build, and especially in the amalgamated build. --- src/boot/boot.janet | 8 ++++++++ src/core/net.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/boot/boot.janet b/src/boot/boot.janet index a4fae6e9..5487befd 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -2852,6 +2852,14 @@ (each h local-headers (do-one-file h)) + # windows.h should not be included in any of the external or internal headers - only in .c files. + (print) + (print "/* Windows work around - winsock2 must be included before windows.h, especially in amalgamated build */") + (print "#if defined(JANET_WINDOWS) && defined(JANET_NET)") + (print "#include ") + (print "#endif") + (print) + (each s core-sources (do-one-file s)) diff --git a/src/core/net.c b/src/core/net.c index 560e5985..dc86f01b 100644 --- a/src/core/net.c +++ b/src/core/net.c @@ -27,8 +27,8 @@ #endif #ifdef JANET_WINDOWS -#include #include +#include #include #pragma comment (lib, "Ws2_32.lib") #pragma comment (lib, "Mswsock.lib")