
On Thu, Dec 4, 2008 at 10:39 PM, Stjepan Rajko <stjepan.rajko@gmail.com> wrote:
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
Hi, Stjepan. There was thread on this topic some time ago, see: http://thread.gmane.org/gmane.comp.lib.boost.devel/177304 I had even booked trac ticket and attached a patch (that provide gcc visibility facilities ) to it, see: https://svn.boost.org/trac/boost/ticket/2114 I would really love to see such functionality in boost, but it was silence from the moment of ticket creation (~5 months ago) so I've became silent too ;). Regards P.S. Comments on patch will be really appreciated