2008/9/8 Dr. Roland Bock
<rbock@eudoxos.de>
Peter,
a) virtual destructor: did not change anything
b) using static libraries: works fine!
Hm. I have not had such a problem before and I we are using quite a few shared objects that throw exception which are caught elsewhere.
Maybe this is related to nm not seeing any symbols?
$ nm lib/libboost_thread-gcc42-mt-1_36.so.1.36.0
nm: lib/libboost_thread-gcc42-mt-1_36.so.1.36.0: no symbols
We are using the gcc option -fvisibility=hidden for our own projects and we require to specify classes or functions which we explicitly want to be exported by shared objects by putting DSOEXPORT in front of the classname. It is defined in the following way:
#ifdef _MSC_VER
#ifdef BUILDING_DSO
#define DSOEXPORT __declspec(dllexport)
#else
#define DSOEXPORT __declspec(dllimport)
#endif
#define DSOLOCAL
#else
#define DSOEXPORT __attribute__ ((visibility("default")))
#define DSOLOCAL __attribute__ ((visibility("hidden")))
#endif
Exceptions declared and thrown in shared objects have to use DSOEXPORT in order to be catched elsewhere.
Boost does not use __attribute__ ((visibility("default"))), therefore typeinfo for exceptions is not exported and you can't catch exceptions thrown by boost.
Roman.
Regards,
Roland