diff --git a/doc/macro_reference.qbk b/doc/macro_reference.qbk index 1ff43fba..d1b221bd 100644 --- a/doc/macro_reference.qbk +++ b/doc/macro_reference.qbk @@ -1664,6 +1664,15 @@ export/import of symbols from shared libraries. ['Deprecated. This macro is no longer necessary since BOOST_SYMBOL_EXPORT and BOOST_SYMBOL_IMPORT are now supplied. It is provided to support legacy code.] ]] +[[`BOOST_DISABLE_EXPLICIT_SYMBOL_VISIBILITY`][ +Disables the effect of the BOOST_SYMBOL_EXPORT, BOOST_SYMBOL_IMPORT and BOOST_SYMBOL_VISIBLE macros, +in order to revert to the default compiler behaviour. +Note that this option should never be used if Boost libraries are being linking against dynamically, +or if you are building a shared library that exposes Boost types in its public API. +It is however advisable when statically-linking against Boost to prevent Boost symbols from leaking from the binary: +for instance because you are building a plug-in for a software which may itself use Boost which could cause +ODR conflicts. +]] ] Typical usage: diff --git a/include/boost/config/detail/suffix.hpp b/include/boost/config/detail/suffix.hpp index 13d4bb6a..07600802 100644 --- a/include/boost/config/detail/suffix.hpp +++ b/include/boost/config/detail/suffix.hpp @@ -47,6 +47,22 @@ # define BOOST_SYMBOL_VISIBLE #endif +// +// disable explicitly enforced visibility +// +#if defined(BOOST_DISABLE_EXPLICIT_SYMBOL_VISIBILITY) + +#undef BOOST_SYMBOL_EXPORT +#define BOOST_SYMBOL_EXPORT + +#undef BOOST_SYMBOL_IMPORT +#define BOOST_SYMBOL_IMPORT + +#undef BOOST_SYMBOL_VISIBLE +#define BOOST_SYMBOL_VISIBLE + +#endif + // // look for long long by looking for the appropriate macros in . // Note that we use limits.h rather than climits for maximal portability,