Boost logo

Boost Users :

From: Angela Breuer (angela.breuer_at_[hidden])
Date: 2021-06-30 14:33:12


Hello,

I'm developing a C++11 shared library that uses Boost.Asio (with Boost
version 1.72) as a header-only library. Exceptions are disabled as the
library is intended to be used on embedded devices that do not support
exceptions and, to ensure this is the case, all interfaces in my library
have the noexcept operator and I have BOOST_EXCEPTION_DISABLE and
BOOST_NO_EXCEPTIONS defined. Additionally, all public interfaces in the
library do not expose any Boost / Boost.Asio types.

When attempting to hide private symbols in my shared library with the GCC
visibility flags and annotations (i.e. -fvisibility=hidden), I learned that
I needed to define BOOST_ASIO_DISABLE_VISIBILITY to disable the visibility
pragmas in Boost.Asio so the boost::asio symbols will also be hidden.
Although I was able to hide the boost::asio symbols with this strategy,
this still results in a subset of boost::system symbols being visible.

I do have some internal helper free functions that accept a
boost::system::error_code. I suspect that they may have something to do
with these visible symbols, but they are completely internal to the library
and the symbols for those helper functions are not visible when I inspect
the library's symbols with nm -DC.

I will note that I was able to hide the boost::system symbols by using a
linker version script, but I do not wish to maintain an unwieldy list of
symbols to export if I can help it.

Is there a supported way to hide the boost::system symbols aside from using
a linker version script? I have attached nm -DC output along with gcc / g++
invocations for reference.

Thank you,
-Angela






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