
Beman Dawes wrote:
On Thu, May 6, 2010 at 12:42 PM, Jürgen Hunold <juergen.hunold@ivembh.de> wrote:
I've got a working patch set lying around. Please find it attached. Real life got in the way (as usual)...
Your patch has been VERY helpful, and I've used it as the starting point! Thanks!
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. 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 Robert Ramey