Boost logo

Boost :

Subject: Re: [boost] questions regarding GCC visibility
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2015-04-01 04:56:31


On Tuesday 31 March 2015 18:48:09 Robert Ramey wrote:
> I made a few changes to simplify code in the serialization library. This
> entailed eliminating support for borland compilers, workarounds for
> compilers which fail to support partial specialization of template function
> and some general clean up. In the course of this effort, I had occasion to
> simplify the code which supports Auto linking - and by extension visibility.
> Things seemed to go pretty well. Feeling frisky, I added the switch
> -fvisibility=hidden to the gcc compile of library. Now applications won't
> link for lack of certain symbols. Well, they link and run fin on my
> machine here at home- but fail in the test matrix.
>
> http://www.boost.org/development/tests/develop/developer/output/Debian-Sid-b
> oost-bin-v2-libs-serialization-test-test_array_binary_archive-test-gcc-4-9-2
> -debug-address-model-64-architecture-x86.html
>
> Funny thing is:
> doesn't seem to be a problem on my machine
> doesn't seem to occur with all exported symbols - only select ones - often
> but not always desctructors
>
> I can switch Jamfile back so it doesn't specify -fvisibility=hidden, but it
> seems that I'm really close to being able to generate a smaller, cleaner DLL
> which I would prefer to do.
>
> Any constructive suggestions would be appreciated.

I suspect base classes may be restricting visibility of your classes. From the
docs[1]:

A class must not have greater visibility than its non-static data member types
and bases, and class members default to the visibility of their class.

For example, basic_oarchive is marked with BOOST_ARCHIVE_OR_WARCHIVE_DECL but
noncopyable and helper_collection which it derives from are not, and as such
have hidden visibility.

[1] https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/Function-Attributes.html#Function-Attributes


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