------- Additional Comments From gdr at integrable-solutions dot net  
2005-01-25 15:53 -------
Subject: Re:  New: exception not caught when passing through C code

"jkanze at cheuvreux dot com" <[EMAIL PROTECTED]> writes:

| When an exception is thrown, terminate is called, even though
| there is an appropriate handler, if there is any C code between
| the exception and the handler.  This is a serious problem because
| a lot of third party software uses a C ABI and callbacks.
| (Note that this works with Sun CC.)

This is documented somewhere in the docs, I think.  
If you mix C codes with C++ and exceptions are raised (through
callbacks) and you need exceptions to smoothly travel across language
boundaries, you need to compile the C code with -fexceptions.

And yes, I too believe that Sun's approach is very sensible.

Ah, I found the doc:

======================
@item -fexceptions
@opindex fexceptions
Enable exception handling.  Generates extra code needed to propagate
exceptions.  For some targets, this implies GCC will generate frame
unwind information for all functions, which can produce significant data
size overhead, although it does not affect execution.  If you do not
specify this option, GCC will enable it by default for languages like
C++ which normally require exception handling, and disable it for
languages like C that do not normally require it.  However, you may need
to enable this option when compiling C code that needs to interoperate
properly with exception handlers written in C++.  You may also wish to
disable this option if you are compiling older C++ programs that don't
use exception handling.
======================

I thinks the PR can be closed.

-- Gaby


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19620

Reply via email to