Boost logo

Boost Users :

Subject: [Boost-users] When to use BOOST_ALL_DYN_LINK?
From: Florian Lindner (mailinglists_at_[hidden])
Date: 2016-10-24 04:43:11


Hello,

http://www.boost.org/doc/libs/1_62_0/libs/log/doc/html/log/installation/config.html says:

BOOST_LOG_DYN_LINK
If defined in user code, the library will assume the binary is built as a dynamically loaded library ("dll" or "so").
Otherwise it is assumed that the library is built in static mode. This macro must be either defined or not defined for
all translation units of user application that uses logging. This macro can help with auto-linking on platforms that
support it.

BOOST_ALL_DYN_LINK
Same as BOOST_LOG_DYN_LINK but also affects other Boost libraries the same way.

We build our library in a dynamic and a static version using SCons:

staticlib = env.StaticLibrary (
    target = buildpath + '/libprecice',
    source = [sourcesPreCICE]
)
env.Alias("staticlib", staticlib)

solib = env.SharedLibrary (
    target = buildpath + '/libprecice',
    source = [sourcesPreCICE]
)
env.Alias("solib", solib)

Both have BOOST_LOG_DYN_LINK set:

env.Append(CPPDEFINES=["BOOST_LOG_DYN_LINK"])

However, I wonder if this is correct. Should DYN_LINK only be set when building the dynamically linked lib?

Thanks,
Florian


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net