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
24.10.2013 1:06, Andrey Semashev пишет: the cases. OTOH, if we use the _WIN32_WINNT, our library will be incompatible with WinXP by default. I propose the following approach: condvar_vista.cpp: ============================== #define _WIN32_WINNT 0x0600 #include <windows.h> #include <condvar.hpp> #ifdef _WIN32_WINNT_VISTA condvar_vista::condvar_vista() { //Vista+ implementation }; #endif //_WIN32_WINNT_VISTA ============================== condvar_win2k.cpp: ============================== #define _WIN32_WINNT 0x0500 #include <windows.h> #include <condvar.hpp> condvar_win2k::condvar_win2k() { //Win2k implementation }; ============================== condvar.hpp: ============================== #if !defined( _WIN32_WINNT ) # pragma message( "_WIN32_WINNT is not defined" ) //ToDo: define USE_VISTA by default after 08 Apr 2014 #else if _WIN32_WINNT >= 0x0600 //Vista+ # define USE_VISTA #endif #include <windows.h> #ifdef _WIN32_WINNT_VISTA class condvar_vista{...}; #endif //_WIN32_WINNT_VISTA class condvar_w2k{...}; #ifdef USE_VISTA typedef condvar_vista condvar; #else typedef condvar_w2k condvar; #endif ============================== 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? -- Best regards, Sergey Cheban