Boost logo

Boost :

Subject: Re: [boost] [atomic] boost.atomic library/win32
From: Lars Viklund (zao_at_[hidden])
Date: 2012-08-09 08:26:17


On Thu, Aug 09, 2012 at 01:31:46PM +0200, Tim Blechmann wrote:
> hello helge,
>
> the shared library of boost.atomic on msvc is currently not really
> usable, as it does not export the pool_.
>
> atm, all boost.lockfree tests of msvc fail for this reason. also
> according to Zao on irc, it will need some specific treatment to avoid
> the compilation of a static library.
>
> [1] http://www.boost.org/development/tests/trunk/developer/lockfree.html

The rites I had to perform to get Atomic to build in a way that it was
usable as a DLL was:

In build/Jamfile.v2:
Augment the project requirements and lib with
      <link>shared:<define>BOOST_ATOMIC_DYN_LINK=1
      <link>static:<define>BOOST_ATOMIC_STATIC_LINK=1

Create boost/atomic/config.hpp as indicated at [2].

In detail/lockpool.hpp, decorate the lockpool class as:
  class BOOST_ATOMIC_DECL lockpool
and move the member functions that touch pool_ into lockpool.cpp, to
avoid them from getting inlined in consumers.

As a side note, if Boost.Atomic is supposed to be a compiled library, it
should probably implement autolinking as per [3].

I might be off on some things here, but this _should_ make it a good
dynamic Boost library. I'm a bit opposed to requiring something to be
dynamic however, as that kind of implies that you need a dynamic
language runtime.

[2] http://www.boost.org/doc/libs/1_50_0/libs/config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_for_libraries_with_separate_source_code.macros_controlling_shared_library_symbol_visibility

[3] http://www.boost.org/doc/libs/1_50_0/libs/config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_for_libraries_with_separate_source_code.automatic_library_selection

-- 
Lars Viklund | zao_at_[hidden]

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