Boost logo

Boost :

Subject: Re: [boost] Boost.Atomic on Windows, patch
From: Václav Zeman (vhaisman_at_[hidden])
Date: 2012-08-03 06:43:15

On 3 August 2012 11:04, Sergey Cheban wrote:
> On 02.08.2012 17:31, Václav Zeman wrote:
>> I have noticed that boost/atomic/detail/generic-cas.hpp is directly
>> including Windows.h header. I consider this problematic for WinSock
>> using applications as Windows.h automatically pulls in Winsock.h, the
>> WinSock 1 header. This is problematic because it requires users that
>> want to use WinSock 2 to order their include of WinSock2.h before
>> inclusion of Boost.Atomic. At this point in time anybody serious about
>> sockets on Windows really do not want to use WinSock 1 but version 2
>> instead. So I suggest the attached patch.
> Why is neccessary to include the windows headers at all? Intrin.h seems to
> be enough: it declares _InterlockedCompareExchange and some other useful
> intrinics, and it does not use the winapi-related stuff.
> Checked on MSVC 2008 and 2010. I remember that I had some problems with
> interlocked functions and intrinics several years ago (with MSVC6,
> probably), but now I cannot reproduce them.
Both intrin.h and windows.h do declare the intrinsic functions using
#pragma intrinsic. It look like a kind of double protection, making
sure that the intrinsics will be available.

BTW, there is a typo in the patch in comment: WindSock2.h --> WinSock2.h


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