Boost logo

Boost :

Subject: [boost] support for gcc hidden visibility in shared libraries
From: Stjepan Rajko (stjepan.rajko_at_[hidden])
Date: 2008-12-04 15:39:33


Hello,

Many (almost all?) linked boost libraries don't work as shared
libraries when compiled with the -fvisibility=hidden switch on gcc
version>=4. I am wondering whether there is interest in making them
work under these circumstances, as it might not be too hard to do, and
there seems to be some benefit to it.

To my limited understanding, making a symbol visible in a shared
library using, say, __attribute__ ((visibility("default"))) on gcc, is
analogous to using __declspec(dllexport) on windows. Many boost
libraries already use macros that apply __declspec(dllexport) on
windows - so these macros could set to expand to __attribute__
((visibility("default"))) on gcc. Even better, a boost-wide macro
could be added to the config headers.

More information on this can be found here:
http://gcc.gnu.org/wiki/Visibility

Just to note, I have very limited understanding of compiling/linking
and I might not have a full grasp of everything involved here. Also,
my only reason for thinking that -fvisibility=hidden should be
supported is that for a long time now, I haven't been able to use
boost shared libraries on my os x platform, and only now I realized
that the reason for this is that I had stuck -fvisibility=hidden in my
user-config.jam a long time ago to suppress some warnings.
Nonetheless, it seems like there are benefits to supporting it that go
beyond preventing people like me from accidentally shooting themselves
in the foot.

Kind regards,

Stjepan


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