Boost logo

Boost :

Subject: Re: [boost] bug-sprint #2114, 2 comments
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2009-06-09 13:15:15


Alexander Arhipenko wrote:

> I have 2 major comment on the updated patch.
> Consider following snippet from gcc.hpp:
> #if __GNUC__ >= 4 && !defined(__MINGW32__) && !defined(__CYGWIN__)
> # define BOOST_SYMBOL_EXPORT __attribute__((visibility("default")))
> # define BOOST_SYMBOL_HIDE __attribute__((visibility("hidden")))
> # define BOOST_SYMBOL_IMPORT BOOST_SYMBOL_EXPORT
>
> ...And assume following scenario:
> Someone is writing shared library (let's name it foo) with
> 'visilibility=hidden' option.
> Library foo is using e.g. boost_filesystem.
> In this case, all the symbols marked with BOOST_FILESYSTEM_DECL
> will be exported from foo library.
> This could easily break foo library's ABI (in case of migration to the
> newest boost version etc.),
> so BOOST_SYMBOL_IMPORT should be defined for gcc as empty macro:
> # define BOOST_SYMBOL_IMPORT.
>
> The second comment:
> BOOST_EXCEPTION_EXPORT/IMPORT are intended for re-exporting exceptions
> from shared library. So, they should be defined for gcc as:
>
> # define BOOST_EXCEPTION_EXPORT BOOST_SYMBOL_EXPORT
> # define BOOST_EXCEPTION_IMPORT BOOST_SYMBOL_EXPORT
>
> and not as:
>
> # define BOOST_EXCEPTION_EXPORT BOOST_SYMBOL_EXPORT
> # define BOOST_EXCEPTION_IMPORT BOOST_SYMBOL_IMPORT

Oh, now I am confused. How exactly those symbols are to be used?
Say, I declare an exception class in a header -- what modifiers
should I use? Do we need BOOST_WHATEVER_EXCEPTION_DECL? Maybe
you can write up some guidance for library authors?

- Volodya


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