From 49ab2e86197620fc0efd14368037b2b1e41a025e Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sat, 16 Jul 2016 19:50:46 +0300 Subject: [PATCH] Fixed compilation with MSVC-8. Make sure _WIN32_WINNT is defined when windows.h is included. This is achieved by (a) making sure boost/detail/winapi/config.hpp is included before any other headers and (b) BOOST_USE_WINDOWS_H is defined so that the header defines _WIN32_WINNT based on the default target Windows version. This ensures that all APIs used by the implementation are available. Also extracted WIN32_LEAN_AND_MEAN definition to the Jamfile so that it is consistently defined for all translation units instead of only tss*.cpp. --- build/Jamfile.v2 | 2 ++ src/win32/thread.cpp | 2 +- src/win32/tss_dll.cpp | 2 +- src/win32/tss_pe.cpp | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index ef67e2fe..62d03427 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -126,6 +126,8 @@ project boost/thread msvc:/wd4512 msvc:/wd6246 + windows:WIN32_LEAN_AND_MEAN + windows:BOOST_USE_WINDOWS_H # : default-build multi : usage-requirements # pass these requirement to dependents (i.e. users) diff --git a/src/win32/thread.cpp b/src/win32/thread.cpp index 023e87ce..7e2c21bc 100644 --- a/src/win32/thread.cpp +++ b/src/win32/thread.cpp @@ -7,6 +7,7 @@ //#define BOOST_THREAD_VERSION 3 +#include #include #include #include @@ -28,7 +29,6 @@ #include #include #include -#include #if BOOST_PLAT_WINDOWS_RUNTIME #include diff --git a/src/win32/tss_dll.cpp b/src/win32/tss_dll.cpp index e0b73e0f..cd71933c 100644 --- a/src/win32/tss_dll.cpp +++ b/src/win32/tss_dll.cpp @@ -3,6 +3,7 @@ // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#include #include @@ -10,7 +11,6 @@ #include - #define WIN32_LEAN_AND_MEAN #include #if defined(__BORLANDC__) diff --git a/src/win32/tss_pe.cpp b/src/win32/tss_pe.cpp index 1aae4a55..841f98b8 100644 --- a/src/win32/tss_pe.cpp +++ b/src/win32/tss_pe.cpp @@ -7,6 +7,7 @@ // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#include #include #if defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_LIB) @@ -77,7 +78,6 @@ extern "C" const IMAGE_TLS_DIRECTORY32 _tls_used __attribute__ ((section(".rdata #include - #define WIN32_LEAN_AND_MEAN #include