On Wed, 2006-09-20 at 11:22 -0500, Dale Rahn wrote:
On Wed, Sep 20, 2006 at 05:10:22PM +0200, Ian Delahorne wrote:
I've run into a problem with throwing (or rather, catching) exceptions
over shared library boundaries in 3.9. When I try to catch an exception
in my application that has been thrown inside a shared library, the
exception isn't caught, but instead causes the program to exit with
SIGABRT. If I link statically it works (not surprising), but this also
works on OpenBSD 3.7 when linked dynamically.
I wrote a simple application to test this, available at
http://www.stacken.kth.se/~ian/exception_test.tar.gz. Am I missing
something when compiling? Or has something radically changed in 3.9?
Shared libraries are to be built using the C/C++ frontend, not ld directly.
If your Makefile is changed from
$(LD) -shared test.o $(LIBS) -o $(TARGET) -lstdc++
to
$(CXX) -shared test.o $(LIBS) -o $(TARGET) -lstdc++
It appears to catch the exception just fine.
Ah, thanks for pointing that out.
/Ian