This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Throw/Catch not working in SO?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]