|
Boost : |
Subject: Re: [boost] [config] GCC symbol visibility across shared libraries
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2010-05-19 09:55:31
Beman Dawes wrote:
> On Thu, May 6, 2010 at 12:42 PM, Jürgen Hunold
> <juergen.hunold_at_[hidden]> 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 { ... };
>
> If you use BOOST_SYMBOL_EXPORT, VC++ will warn because
> __declspec(dllexport) isn't valid in this context.
I don't understand the problem in that case. I mark classes with __declspec(dllexport). Is it that VC's linker notices that there are no symbols in the DLL for a header-only class and complains?
> 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.
Given what you've asserted, I think BOOST_SYMBOL_VISIBLE is reasonable.
_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk