Boost logo

Boost :

Subject: [boost] [winapi] Default target Windows version
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2013-10-15 16:50:21


First, a little intro. As part of ongoing work on Boost.Sync we've created
quite a few headers with WinAPI declarations that are often needed in Boost
libraries. The headers are in boost/detail/winapi and can be used by any
library that wishes to avoid including windows.h.

The headers declare some symbols that depend on the target Windows version.
For example, GetTickCount64 only appeared in Windows Vista. The user can
define BOOST_USE_WINAPI_VERSION macro before including any Boost headers to
indicate the target WinAPI version Boost should use. If the macro is not
defined, the headers attempt to deduce the target Windows version from the
_WIN32_WINNT and WINVER macros, if they are defined by the user. Lastly, if
everything fails, the headers fall back to a default, which is currently
Windows XP.

I wanted to ask the community if it is appropriate to raise the default to
Windows Vista. The rationale for this is that Vista introduced a lot of useful
APIs (in thread synchronization, in particular) and XP is losing its
popularity and soon will be completely unsupported by Microsoft. Also, I'm not
sure what is the current state of affair, but Microsoft already tried to drop
pre-Vista targets in MSVC.

Note that I'm not suggesting to drop support for pre-Vista Windows. The user
will still be able to enable previous versions of WinAPI in one of the
mentioned above ways.

Lastly, I'd like to encourage Boost developers to use this protocol for
defining WinAPI version used by libraries. It would be ideal if by defining
BOOST_USE_WINAPI_VERSION the user would be able to control WinAPI version used
by all Boost libraries, not just Boost.Sync and Boost.Chrono (the current
users of these headers). If you want to add support for this protocol to your
library, simply include boost/detail/winapi/config.hpp. This will result in
BOOST_USE_WINAPI_VERSION being defined so that it can be checked by the
library. Other headers boost/detail/winapi make use of this macro, you can see
them as an example.

Boost list run by bdawes at, gregod at, cpdaniel at, john at