This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Throw/Catch not working in SO?
- From: Janis Johnson <janis187 at us dot ibm dot com>
- To: "Charles Y. Kim" <ckim at telcontar dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 14 Oct 2002 17:15:42 -0700
- Subject: Re: Throw/Catch not working in SO?
- References: <000e01c273d2$4e4ef900$7201000a@sanjose.telcontar.com>
On Mon, Oct 14, 2002 at 03:37:40PM -0700, Charles Y. Kim wrote:
> Hi all,
>
> I'm using some exception handling in a shared object, and while the
> throw()/catch() works in both Windows and FreeBSD (using GCC 2.96), in Linux
> (GCC 3.02 --enable-shared --enable-threads=posix) the throw is executed, and
> the catch never happens.
>
> For example... let's say I have the following code in the shared object...
>
> void error() {
> throw(1);
> }
>
> void error2() {
> error();
> }
>
> void function() {
> try {
> if (blah)
> error2();
> }
> catch(...) {
> printf("exception caught");
> }
> }
>
> I know that error2() is being called and the exception is being thrown...
> but it's not being caught at all.
>
> Does anyone have ANY ideas?
It works fine for me with GCC 3.0.4 on i686-pc-linux-gnu, but I
can't tell what I might have done differently.
Your code fragment isn't complete (it can't be compiled without
additional code added), and you don't say how you built your shared
object or how you know that error2 was called. If you provide a
complete example, someone might be able to help.
Janis