summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gc_cpp.cc1
-rw-r--r--include/gc.h3
-rw-r--r--tests/test_cpp.cc1
3 files changed, 4 insertions, 1 deletions
diff --git a/gc_cpp.cc b/gc_cpp.cc
index 88ffe96e..baf8ca49 100644
--- a/gc_cpp.cc
+++ b/gc_cpp.cc
@@ -27,6 +27,7 @@ built-in "new" and "delete".
# define GC_BUILD
#endif
+#define GC_DONT_INCL_WINDOWS_H
#include "gc.h"
#include <new> // for bad_alloc, precedes include of gc_cpp.h
diff --git a/include/gc.h b/include/gc.h
index 0f5d8435..e43f7f75 100644
--- a/include/gc.h
+++ b/include/gc.h
@@ -1688,7 +1688,8 @@ GC_API void GC_CALL GC_register_has_static_roots_callback(
/* Note: for Cygwin and pthreads-win32, this is skipped */
/* unless windows.h is included before gc.h. */
-# if !defined(GC_NO_THREAD_DECLS) || defined(GC_BUILD)
+# if (!defined(GC_NO_THREAD_DECLS) || defined(GC_BUILD)) \
+ && !defined(GC_DONT_INCL_WINDOWS_H)
# ifdef __cplusplus
} /* Including windows.h in an extern "C" context no longer works. */
diff --git a/tests/test_cpp.cc b/tests/test_cpp.cc
index 669bf782..493ec33d 100644
--- a/tests/test_cpp.cc
+++ b/tests/test_cpp.cc
@@ -28,6 +28,7 @@ few minutes to complete.
#undef GC_BUILD
+#define GC_DONT_INCL_WINDOWS_H
#include "gc_cpp.h"
#include <stdio.h>