Subject: Re: [boost] [winapi] Default target Windows version
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2013-10-23 20:53:01
On Thursday 24 October 2013 02:40:06 Sergey Cheban wrote:
> 24.10.2013 1:06, Andrey Semashev Ð¿Ð¸ÑÐµÑ:
> > Maybe it would be a good idea to just include sdkddkver.h and then analyze
> > _WIN32_WINNT value so that Boost automatically uses the right WinAPI. If
> > the user does not define this macro then we use whatever the default is
> > in the current SDK.
> I don't think so. The default _WIN32_WINNT=0x0601 in the windows sdk is
> very high but it does not break compatibility with WinXP in the most of
> the cases. OTOH, if we use the _WIN32_WINNT, our library will be
> incompatible with WinXP by default.
I think if the user targets for XP compatibility, he has to define
_WIN32_WINNT anyway, and not just for his code but also for all the third-
party code he compiles. If he uses externally built binaries, he has to trust
the provider of these binaries that they were built compatible with XP (i.e.
with _WIN32_WINNT defined).
If you don't define _WIN32_WINNT, you basically rely on Windows SDK to choose
the default. And I think this is actually a good strategy to choose the
default for Boost, too. Use whatever is allowed by the user and the SDK.
> I propose the following approach:
> With this approach, our library will contain both implementations of the
> condvar class (providing the SDK is not too old). To choose between
> them, developers will have to define _WIN32_WINNT for their applications
> but will not have to recompile our library.
> What do you think about this idea?
That won't work because condvar_vista would involve functions that are not
present in XP. Any built Boost binary will contain references to these
functions and will not load on XP.
If we speak only of header-only components implemented that way, assuming no
built binaries use them, then that is already the plan. Boost.Sync will
contain implementations for XP and Vista, and will select them based on the
chosen WinAPI version. But I assure you that mutexes and condition variables
will be used in built binaries and thus it does not solve the problem.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk