Exception thrown from multithreaded shared lib not caught in main
Martin York
martin.york@veritas.com
Tue Dec 7 16:18:00 GMT 2004
void Lixo::lib_func() throw()
{
throw Lixo::ValidationException("Hello!");
}
The above code, will result in a call to std::unexpected() and thus to std::terminare() and from there abort() resulting in the application exiting without the stack unwinding to main().
By specifying that the method 'lib_func()' throws nothing 'throw()' any thrown exception (because they are all unexpected) should generate a call to std::unexpected().
Martin.
-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On Behalf Of Joao Luis Pinto
Sent: 06 December 2004 03:05
To: gcc-help@gcc.gnu.org
Subject: Re: Exception thrown from multithreaded shared lib not caught in main
Hello again,
Following my previously presented problem, I have built an example that replicates the problem:
http://jpinto.homeip.net/~jpinto/lixo-0.1.0.tar.gz
Just run ./configure && make check
It builds a shared library with a function that throws an exception, and an executable that calls the library function. Aparently multi-threading is not the issue. The problem is that the exception is never caught in main(), and unhandled() gets called.
Tested with g++-3.3.4 and g++-3.4.2 (Debian testing x86).
Thank you for your time.
João Luis
More information about the Gcc-help
mailing list