Boost logo

Boost :

Subject: Re: [boost] [config] GCC symbol visibility across shared libraries
From: Jürgen Hunold (juergen.hunold_at_[hidden])
Date: 2010-05-19 14:04:44


On Wednesday, 19. May 2010 18:36:21 you wrote:
> Beman Dawes wrote:

> >> The patch introduces two Boost.Config macros
> >> - BOOST_SYMBOL_EXPORT
> >> - BOOST_SYMBOL_IMPORT
> >
> > AFAICT, a third macro is needed for GCC. I've named it
> > BOOST_SYMBOL_VISIBLE and define it as
> > __attribute__((visibility("default")))
> >
> > The need for this macro arises in header only classes like this:
> > class BOOST_SYMBOL_VISIBLE my_exception : public
> >
> > std::runtime_error { ... };

Okay, I'm not used to exceptions (legacy code...) .

> > If you use BOOST_SYMBOL_EXPORT, VC++ will warn because
> > __declspec(dllexport) isn't valid in this context. If you don't
> > decorate my_exception at all, VC++ is happy, but GCC shared libraries
> > compiled with -fvisibility=hidden can't successfully throw exceptions
> > up to callers outside the shared library. The only way around that I
> > can see is to use a separate macro that is only defined for GCC.
>
> Note: some of this funtionality, or something similar, might already be
> found in
> boost/serialization/force_include.hpp

Yes, this is be

# define BOOST_USED __attribute__ ((used))

isn't it ?

I've skipped most of serialization/archive due the non-standard definition of
the export/import macros. And it is the only library which has a special case
for Borland

        #if defined(__BORLANDC__)
            #define BOOST_SERIALIZATION_DECL(T) T __export

I'm not sure if this is still needed and why you decided to use this syntax.
I hope that you can shed some light on this and maybe unify those macros, too.

Yours,

Jürgen

-- 
* Dipl.-Math. Jürgen Hunold       ! Ingenieurgesellschaft für 
* voice: ++49 511 262926 57       ! Verkehrs- und Eisenbahnwesen mbH  
* fax  : ++49 511 262926 99       ! Lister Straße 15
* juergen.hunold_at_[hidden]        ! www.ivembh.de
* 
* Geschäftsführer:                ! Sitz des Unternehmens: Hannover
* Prof. Dr.-Ing. Thomas Siefer    ! Amtsgericht Hannover, HRB 56965
* PD Dr.-Ing. Alfons Radtke       !

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