Boost logo

Boost :

Subject: Re: [boost] gcc visibility support
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2009-06-07 19:16:07


On Monday 08 June 2009 01:16:13 Vladimir Prus wrote:
> Andrey Semashev wrote:

> > Last time I heard the patch broke program_options.
>
> It appears to work now, though. I suspect this is because every exception
> in boost/program_options/errors.hpp is already marked with
> BOOST_PROGRAM_OPTIONS_DECL.

I guess, someone has already fixed it then. Splendid.

> > Perhaps we could search for exception classes and mark them as exported
> > right away? We could do this, e.g., by looking for throw_exception or
> > throw expressions. A lot of work, I know, but it has to be done anyway.
>
> Hmm, isn't every exception class supposed to be marked with BOOST_XXX_DECL
> anyway?

No, if it's header-only. That's one of the problems with the patch: such
exceptions should not be marked in any way for MSVC (and other compilers with
the similar type_info support), but should always have default visibility for
GCC on Linux.

> > Maybe there are other procedures necessary to make sure it works.
> > Boost.Exception comes to mind as a possible source of issues. It is
> > related to both exceptions and dynamic_cast. I'm guessing, at least
> > error_info should be exported, too.
>
> I am unsure why -- it is ever used where typeid matters?

Unless we're banning visibility=hidden, it may matter. IIRC, Boost.Exception
uses type_info to acquire error_info at the catch site. If it isn't exported,
the acquisition will fail, because type_infos will not match.

Oh, and for the same reason boost::exception should be exported, too, as it
can be used to catch exceptions or as a target type for dynamic_casts.

However, I'm not that familiar with the library implementation to be
absolutely sure. I hope that the library maintainer is reading this.


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