Boost logo

Boost :

Subject: Re: [boost] [atomic] [release] possible linking problem with atomic
From: Tim Blechmann (tim_at_[hidden])
Date: 2013-01-11 14:19:43


>>> Is there any point in building a static Boost.Atomic library? I see why
>>> it'd
>>> be necessary to have the spinlock pool in its own DLL on Windows, but a
>>> static library doesn't seem to be adding anything. DLLs will still have
>>> separate copies of the spinlock pool. You might as well keep it
>>> header-only.
>>
>> that's exactly the reason, why i suggested to build a shared library
>> only. multi-module applications should *not* link to a static lib if
>> they share atomic objects.
>
> Isn't this only true on Windows? (Unless the spinlock pool has
> visibility=hidden, but it shouldn't).

i'm definitely not an expert on dynamic linking, but when loading a
library with dlopen (and RTLD_LOCAL), symbols in this library won't be
used to resolve references in other libraries. so if two shared
libraries both statically link to boost.atomic, i'd expect to have one
spinlock pool per library.

tim


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