Boost logo

Boost :

Subject: Re: [boost] [config] Request for BOOST_SYMBOL_IMPORT_VISIBLE ?
From: John Maddock (boost.regex_at_[hidden])
Date: 2011-01-29 11:47:46


> 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")))".
> I believe this is need to address the following two scenarios:
>
> (For gcc, assume all libraries are built with the following
> ption: -fvisibility=hidden)
>
> **********
> Scenario 1
> **********
> Export class MyException from Library A.
> Catch MyException in Library B, and be able to throw or rethrow it from
> Library B.
> Catch MyException in Library C.

I think this is a real problem, but the solution is rather cumbersome - a
Boost library header would then have to support:

1) Exporting from dll.
2) Importing to executable.
3) Importing to dll and re-exporting.
4) None of the above (static lib).

Looking at http://gcc.gnu.org/wiki/Visibility they suggest that 2 & 3 are
the same, and both are __attribute__ ((visibility("default"))) on gcc. Sp
my suggestion is that we fix the existing macros to do the right thing and
change GCC's BOOST_SYMBOL_IMPORT to __attribute__ ((visibility("default"))).

Thoughts?

Thanks for raising this, John.


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