This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
gcc-2.95.3: exceptions from shared libraries result in abort
- To: gcc-bugs at gcc dot gnu dot org
- Subject: gcc-2.95.3: exceptions from shared libraries result in abort
- From: Dimitris Vyzovitis <vyzo at media dot mit dot edu>
- Date: Tue, 5 Jun 2001 21:34:06 -0400 (EDT)
I have problems with handling exceptions thrown from shared libraries. In
particular, any exception thrown by one of my shared libraries will
result in a core dump, even though I have suitable exception handlers.
My gcc is "gcc version 2.95.3 20010315 (release)" and was compiled with
--enable-shared. binutils is 2.11.90.0.1
Here is a small test case, together with the compilatio/linker flags I use.
Am I doing something wrong or is this a bug?
### File: tlib.h
struct tlib {
void doit();
};
### File tlib.C
#include "tlib.h"
void tlib::doit() {
throw "something";
}
### Shared library is compiled with:
$ g++ -fPIC -c testtlib.C
$ g++ -L. -ltlib testtlib.o -o testlib
### Test progarm: testtlib.C
#include <iostream>
#include "tlib.h"
int main() {
try {
tlib t;
t.doit();
} catch ( ... ) {
cerr << "Exception!" << endl << flush;
}
}
### test program compiled and linked with
$ g++ -fPIC -c tlib.C
$ g++ -L. -ltlib testtlib.o -o testlib
Running the program simply results in core dump, despite the presence of
the default exception handler.
-- dimitris
mailto:vyzo@media.mit.edu