Boost logo

Boost :

Subject: Re: [boost] [config] Request for BOOST_SYMBOL_IMPORT_VISIBLE ?
From: Mostafa (mostafa_working_away_at_[hidden])
Date: 2011-02-07 03:35:32


On Mon, 07 Feb 2011 00:10:26 -0800, Mostafa
<mostafa_working_away_at_[hidden]> wrote:

> On Mon, 31 Jan 2011 07:00:50 -0800, Alexander Arhipenko
> <arhipjan_at_[hidden]> wrote:
>
>> On Sat, Jan 29, 2011 at 2:37 AM, Mostafa
>> <mostafa_working_away_at_[hidden]> wrote:
>>> Hi,
>>>
>>> I propose the introduction of BOOST_SYMBOL_IMPORT_VISIBLE to
>>> Boost.Config
>>> that behaves like BOOST_SYMBOL_IMPORT in all cases except gcc (and like
>>> compilers?) where it expands to
>>> "__attribute__((visibility("default")))".
>> [snip]...
>>
>
> [snip]
>
>> The more elegant solution would be to have (as you are proposing)
>> special
>> macroses in boost.config. BOOST_SYMBOL_VISIBLE is okay but it does
>> nothing on msvc.
>
> That's the problem I ran into. On msvc, it's ok if all you want to do is
> catch the exception outside of the defining dll, but if you want to
> export
> the said exception and throw outside of the dll, then you need to
> export/import from the dll. It seems to me, from having gone back and
> read the discussion threads on this topic, that BOOST_SYMBOL_VISIBLE was
> sort of a gcc specific addition to enable re-exporting exceptions from
> gcc
> dso's. In the least, I believe that your proposal below should
> completely
> replace BOOST_SYMBOL_VISIBLE, as it takes into account both gcc and msvc.
>
>> 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?

Regards,

Mostafa


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