Boost logo

Boost :

Subject: Re: [boost] [winapi] Problem with the latest clang on Windows
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2015-06-05 04:31:36


On Friday 05 June 2015 19:04:51 Gavin Lambert wrote:
>
> What is the reason that Boost WinAPI redeclares the structure? Can it
> be changed to just use the one from the Windows headers (perhaps via
> typedef, if the internal typename is needed for compatibility)?
>
> (After writing the above, a cursory glance at the code suggests that it
> does do that if BOOST_USE_WINDOWS_H is defined. So that changes the
> question: under what conditions is that not defined?)

The reason of Boost.WinAPI existence is that people don't want to include
windows.h, especially in public headers. It is a heavy header that brings in
most of SDK. It depends on predefined macros, so including it once defines the
API users will be able to use; this is inconvenient for both Boost and its
users. Also, windows.h defines a few offending macros, like min/max.

In order to provide Windows API Boost.WinAPI has to redefine functions and
structures from Windows SDK in a binary compatible way but in the way it
doesn't conflict with windows.h. That's the current implementation.

BOOST_USE_WINDOWS_H is a macro that can be defined by the user if he wants
Boost to include windows.h. There's not much practical point in this except to
solve compatibility problems like in the original post.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk