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] |
On 30-Mar-2002, Kai Henningsen <kaih@khms.westfalen.de> wrote: > Is it currently (that is, in any version in CVS) possible to access the > gcc exception machinery from C (that is, throw and catch exceptions of > some kind), possibly via some builtins and/or libsupc++ routines? How about just writing a simple library in C++, using `extern "C"' so that this library is easily accessible from C code? It is desirable to have a single standard exception-handling library in C, not only for doing exception handling in C, but also for other languages. Many languages implementations compile to C, or have run-time libraries written in C, and providing such a library would allow these implementations to support exceptions in a way that is compatible with C or C++ code using exceptions. This would allow exceptions thrown by code written in one language to be caught by code written in a different language, without requiring the different language implementations to interface directly with the GCC back-end exception-handling support (a much higher bar). I have just written such a library -- see attached. The library defines a C interface which can be implemented either in C++, using exceptions, or in C, using setjmp/longjmp. I would appreciate comments on the proposed interface. In the long run I think it would be nice for something like this to be included in the C standard. -- Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit The University of Melbourne | of excellence is a lethal habit" WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
Attachment:
CXCPT-0.1.tar.gz
Description: application/gunzip
Attachment:
c_exceptions.h
Description: Text document
Attachment:
c_exceptions.cpp
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |