My project consists of the following elements:
- my program, written mostly in C ++ 11 (so this is not a practical attempt to compile it in C ++ 03 mode)
- shared library ( https://github.com/SOCI/soci ) compiled with the same compiler
SOCI throws exceptions that I need to catch in my code. It was used to work with GCC4.7.3, but now I switched to GCC4.8.1, this no longer occurs: the exception is thrown through all the handlers (including catch(...) ) and causes the completion:
terminate called after throwing an instance of 'soci::mysql_soci_error' what(): Table 'brphrprhprh' doesn't exist The program has unexpectedly finished.
What I tried:
- throws the same exception from my code (next to the problem): it falls into the right handler;
- recompiling SOCI with
-std=c++11 : no difference - adding
__attribute__((visibility("default"))) to the exception class: no difference use of the -u option for typeinfo -related characters: no difference in behavior, characters are displayed as undefined in nm . Note that without -u there are none at all:
$ nm -D -C myprogram | grep soci | grep error U soci::soci_error::soci_error(std::string const&) 000000000044013a W soci::soci_error::~soci_error() 0000000000440124 W soci::soci_error::~soci_error() 0000000000440124 W soci::soci_error::~soci_error() 00000000004c43b0 V typeinfo for soci::soci_error U typeinfo for soci::mysql_soci_error 00000000004c43d0 V typeinfo name for soci::soci_error U typeinfo name for soci::mysql_soci_error 00000000004c60c0 V vtable for soci::soci_error U vtable for soci::mysql_soci_error
I also read http://gcc.gnu.org/wiki/Visibility , but something else should be missing.
Any tips?
EDIT
This is actually not a problem with the dynamic library. I would have to try to compile it statically - and save a lot of time, because the behavior will not really change. (See Answer)
source share