Merge pull request #441 from jcelerier/develop

Add a macro BOOST_DISABLE_EXPLICIT_SYMBOL_VISIBILITY to disable mandatory symbol visibility
This commit is contained in:
jzmaddock
2022-09-17 16:24:50 +01:00
committed by GitHub
2 changed files with 25 additions and 0 deletions

View File

@ -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:

View File

@ -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 <limits.h>.
// Note that we use limits.h rather than climits for maximal portability,