Bug #950
Exception/shared objects bug
0%
Description
Alex, this was a bug that baffled me in, say MapCppSimulation. I wonder whether it still turns up now we have this API layer...
So let's say I throw an exception in, say, a function that resides in libMausCpp.so (or even an external shared libary), and try to catch it in, say _MapCppSimulation.so. The catch() in _MapCppSimulation.so does not recognise the Squeal as a Squeal. Take the example below:
////////// COMPILED INTO LIBMAUSCPP.SO ///////// #include "src/legacy/Interface/Squeal.hh" void foo() { throw Squeal(Squeal::recoverable, "Test exception", "foo"); }
I try to catch this in MapSomeMap.cc
////////// COMPILED INTO _MAPCPPSOMEMAP.SO ///////// #include "src/legacy/Interface/Squeal.hh" std::string MapCppSomeMap::process(std::string json_document) { try { foo(); } catch (Squeal squee) { squee.Print(); } }
The Squeal doesn't get caught. In fact, the only way to catch these exceptions is to catch the std::exception base class. It looks like C++ doesn't understand the name Squeal because it is defined in an external shared object file! Have a look at this blog entry for example:
http://www.code-muse.com/blog/?p=58
So I tried changing compiler flags, in fact it didn't help. I also tried hacking around with some pragma as discussed here:
http://gcc.gnu.org/wiki/Visibility
But no cigar. So if you fancy something fun, maybe you could have a look?