Boost logo

Boost :

Subject: Re: [boost] [Boost-users] cross-compilation x86_64-w64-ming32: undefined reference to `InterlockedIncrement'
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2013-09-23 15:41:05


On Mon, Sep 23, 2013 at 5:48 PM, Peter Dimov <lists_at_[hidden]> wrote:

> Andrey Semashev wrote:
>
>> The macros are supposed to provide low level atomic ops on Windows,
>> aren't they? Wouldn't it be better to use gcc atomic intrinsics instead of
>> WinAPI calls in case of MinGW?
>>
>
> No, the macros were supposed to be a portable way of accessing the
> Interlocked* family of WinAPI calls without having to #include <windows.h>.
> That's probably why shared_ptr doesn't have a problem on MingW64 - it uses
> a g++ specific implementation there. (Interlocked* later mutated into
> compiler intrinsics.)
>

Yes, MinGW-w64 defines _Interlocked* functions in terms of gcc intrinsics
internally, in intrin.h. This header is only available in MinGW-w64 and not
MinGW (the original project). Considering all that I prepared a patch for
interlocked.hpp (attached, the patch is against trunk).




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk