Subject: Re: [boost] Boost.Atomic on Windows, patch
From: Sergey Cheban (s.cheban_at_[hidden])
Date: 2012-08-03 13:43:06
On 03.08.2012 14:43, VÃ¡clav Zeman wrote:
>> Why is neccessary to include the windows headers at all? Intrin.h seems to
>> be enough: it declares _InterlockedCompareExchange and some other useful
>> intrinsics, 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.
No. Windows.h does not declare _InterlockedCompareExchange at all.
Instead, it declares InterlockedCompareExchange (without underscore)
that is not an intrinsic but a function implemented in the Kernel32.lib.
For the x86, there is also an implementation in the kernel32.dll but the
programs that were built with modern versions of the Windows SDK don't
The following does not work:
_InterlockedCompareExchange( &l, 0,0 );
//error C3861: '_InterlockedCompareExchange': identifier not found
So, windows.h and winsock2.h are useless for those who want to use
-- Sergey Cheban -- Sergey Cheban
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk