|
Boost : |
Subject: Re: [boost] Recommended way of dealing with windows.h in headers?
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2012-05-02 12:50:04
Le 02/05/12 13:31, Mathias Gaunard a écrit :
> What's the recommended way to deal with windows.h in Boost?
>
> I see a lot of libraries doing stuff like
>
> #if defined( BOOST_USE_WINDOWS_H )
> # include <windows.h>
> #endif
>
> namespace boost
> {
>
> namespace detail
> {
>
> #if !defined( BOOST_USE_WINDOWS_H )
> extern "C" void __stdcall Sleep( unsigned long ms );
> #endif
>
>
> So should libraries just declare all symbols themselves? But here the
> declaration is wrong, it misses __declspec(dllimport) for example when
> the runtime CRT is used, unnecessarily requiring import libraries.
>
> WINBASEAPI/WINADVAPI macros could be used to fix that.
>
> There is also the file
> <boost/detail/win/basic_types.hpp>
>
> that contains a few of the types, but it doesn't seem to be used that
> much except by other files in detail/win, and then again they don't
> re-use WINAPI and other macros. It also seems to be lacking the
> WINBASEAPI/WINADVAPI macros.
>
> Also, why couldn't headers simply include <windef.h> then <winbase.h>?
> Does that cause problems too?
>
Hi,
I don't know too much about Windows api. I created the files
boost/detail/win/* for boost.Chrono expecting that other libraries would
migrate to use them instead of its own interface.
Please be free to make any concrete proposal that could improve these
files. Maybe you can provide a patch ;-)
Best,
Vicente
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk