The sound of exceptions whooshing by....
david.hagood@gmail.com
david.hagood@gmail.com
Mon Jan 30 21:44:00 GMT 2012
I am having a strange C++ behavior, relating to exceptions.
I have an exception thrown in a shared library (specifically, the ACE TAO
CORBA libraries, libCosNaming.so).
At the point of the call (which is in a different shared library), I have
a try/catch block:
try {
Root_NamingContext->bind(cos_name, Stubb.in());
}
catch (const CosNaming::NamingContext::AlreadyBound &) {
// it's ok to fail here, we expect this
}
The program is linked against both libCosNaming and my library. In main, I
have a try/catch:
try {
libfunction()
}
catch (const CosNaming::NamingContext::AlreadyBound &) {
std::cerr << "1" << std::endl;
}
catch (...) {
std::cerr << "2" << std::endl;
}
Now, I execute the program. Under an X86 build (i686-unknown-linux-gnu-gcc
(crosstool-NG-1.7.0) 4.3.3), all is well - the exception is caught in my
shared library, and life goes on.
Under an ARM build (running under Linux as well -
arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q3-67) 4.4.1), the
exception goes whizzing by everybody and right to std::terminate().
I've been checking to insure I force visibility (-fvisibility=default),
that the typeinfo for the exception type is defined in libCosNaming and
NOT in my library, etc., and as far as I can see, all should be well. I've
read http://gcc.gnu.org/wiki/Visibility, and I assert I'm following its
pronouncements. Moreover, even if the typeinfo weren't visible, I'd expect
the catch(...) to get anything, regardless of type.
Does anybody have any suggestions on what might be going on?
More information about the Gcc-help
mailing list