Boost logo

Boost :

Subject: Re: [boost] questions regarding GCC visibility
From: Robert Ramey (ramey_at_[hidden])
Date: 2015-04-01 11:06:21


Rob Stewart wrote
>> 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
> [snip]
>> Any constructive suggestions would be appreciated.
>
> I haven't looked at the source, but I'll mention a few things that may be
> helpful. Default visibility can be set on an entire class or on individual
> member functions. Compiler generated special member functions will be
> hidden if the class is hidden. Types for which RTTI is needed should have
> default visibility, as should exception types.
>
> Does your local build succeed after cleaning all build artifacts?

On my local system, I made the change to the Jamfile and rebuilt but nothing
happened. I'm guessing that b2 doesn't consider the Jamfile itself as a
dependency. So I then deleted all previous build files for the compiler in
question - gcc 4.9. Then I rebuilt the library and ran all the tests.
Everything looked good. Then I pushed the change to git hub and watched the
development results - and they are starting to show failures. So that is how
I got to where I am.

I should note that the same attribute tags, macros, etc are used to
export/import symbols for the windows system and this has been working well
for many years. The only change in that was I that I used the more recent
BOOST_SYMBOL_EXPORT/IMPORT macros to make things more readable. Since the
windows tests seem to work well, I'm feel comfortable in concluding that
this change hasn't had any ill effects.

I'm guessing that are some subtle differences in the rules between the two
platforms. The gcc documentation on the subject is suspiciously complicated
compare to the windows explanation.

I could restore the previous of the jamfile which comments out the
visibility=hidden switch. But I feel that I'm pretty close to getting it
right and I think that excluding extraneous stuff from the shared library
objects make for a better product. So I'll spend a little more time on it
before I give up.

Thanks to all for the suggestions.

Robert Ramey

PS - one post mentioned the possibility of assigning a visibility attribute
to a whole namespace. This looks interesting but I never saw it anywhere.
It's also unclear whether or not it's portable

--
View this message in context: http://boost.2283326.n4.nabble.com/questions-regarding-GCC-visibility-tp4673994p4674019.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

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