-------- Original-Nachricht -------- > Datum: Fri, 19 Oct 2007 04:29:38 -0700 > Von: "John (Eljay) Love-Jensen" <eljay@xxxxxxxxx> > An: tahoma@xxxxxx, gcc-help@xxxxxxxxxxx > Betreff: RE: exceptions not caught from shared libraries loaded with dlopen > Hi Jan, > > > I have a real serious problem with g++ version 4.2.1 and lower. > > Perhaps. > > Or perhaps you have an OS that does not support throwing exceptions across > shared library boundaries. (In particular, the RTTI of the object is > strongly linked to the type information in the shared library, and does not > compare as the same to the type information in the code that catches the > exception which is strongly linked to a different type information structure. > The OS does not support vague linkage.) > > Which OS are you using? I forgot to mention, sorry. ...$ g++ -v Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-targets=all --disable-werror --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu Thread model: posix gcc version 4.2.1 (Debian 4.2.1-5) Adding RTLD_GLOBAL to dlopen flags solves the problem for now. I have to investigate further. I stumbled across this behaviour while creating C++ Wrappers for Python with Swig. The order of importing the generated wrapper libraries results in different result. Exceptions thrown in C++ will be caught one time the other time not. So I stripped down the generated wrapper code and tried to emulate Python's import. I do not know whether Python uses RTLD_GLOBAL when importing libraries or not. Thank you, Jan -- Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kanns mit allen: http://www.gmx.net/de/go/multimessenger