|
Boost : |
Subject: Re: [boost] [config] Request for BOOST_SYMBOL_IMPORT_VISIBLE ?
From: Mostafa (mostafa_working_away_at_[hidden])
Date: 2011-02-07 13:44:25
On Mon, 07 Feb 2011 02:26:34 -0800, John Maddock <boost.regex_at_[hidden]>
wrote:
>>>> So, I propose to have 2 new macroses:
>>>> BOOST_SYMBOL_VISIBLE_EXPORT//export "always" visible symbol from the
>>>> library
>>>> BOOST_SYMBOL_VISIBLE_IMPORT//import "always" visible symbol to the
>>>> library
>>>
>>> Mostafa
>>
>> Though I suggest the names:
>>
>> BOOST_SYMBOL_EXCEPTION_EXPORT
>> BOOST_SYMBOL_EXCEPTION_IMPORT
>>
>> to emphasize that this macros should be only used with exceptions.
>> Having BOOST_SYMBOL_EXPORT and BOOST_SYMBOL_VISIBLE_EXPORT is kind of
>> confusing, whereas the names BOOST_SYMBOL_EXPORT and
>> BOOST_SYMBOL_EXCEPTION_EXPORT are self-explanatory, I don't need the
>> look up reference manual to figure out what they do when I'm scanning
>> code.
>>
>> Any thoughts?
>
> Is this really just limited to exception classes? I got the impression
> from the GCC docs that the issue might extend to:
>
> * Classes with vtables that are used in dynamic_cast's or with typeid.
> * Classes with static data members.
From my reading of it, the "re-exporting" is limited to exception
classes;
albeit, the article could be clearer. This is because (again, according
to the article) the catch handler looks for the exception class typeinfo
in the dso that threw it, and not in the dso that originally defined the
exception, hence the need to "re-export" the exception from all dsos that
potentially throw it.
With respect to the category of classes that you mention the
"re-exporting" issue might extend to, I think the article is just advising
to just export these classes, or their static data members in the first
place, not "re-export" them from every dso that they appear in.
BUT ...., some simple tests I performed seem to only partially validate my
claim (see attached for the tests).
All tests run on: OSX 10.5, gcc version 4.0.1
With respect to the dynamic_cast/typeid category, my tests revealed no
need for "re-exporting", even when I compiled with "-O3" flag.
With respect to template classes with static data members, my tests did
reveal a need for "re-exporting".
Admittedly, it would be nice if we can get some clarification from the gcc
team regarding this.
> I still think that re-exporting "just enough and no more" is error
> prone, and we should just follow the gcc guidelines and re-export
> everything that's imported - I rather got the impression that gcc will
> only actually generate re-export data for vtables anyway?
True, it may be error prone. Sorry, I can't seem to find the gcc
guideline you're referring to, can you point it out?
Thanks,
Mostafa
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk