[Ecls-list] exception question
worm at arrakis.es
Fri May 7 13:15:06 UTC 2004
> Is it possible to throw a C++ exception within a
> application callback function (i.e. a function set up
> via a call to cl_def_c_function() or
> cl_make_cclosure_va()) and have that exception
> propagate through the embedded interpreter, back to
> the calling application?
> I'm trying to do this using 'throw runtime_error(...'
> but I get "System error. Trying to recover ..." from
> the interpreter when the exception is thrown.
This error is not from ECL :-/ Did you compile ECL using a C++ compiler
(option --with-cxx at configuration time)? If so, then I really do not
know how ECL can interfere with the exception system from C++. The only
fancy thing ECL uses are setjmp/longjmp, but they are standard and
should be tolerated by C++.
However, throwing exceptions may leave the ECL interpreter in an
undesirable state of confusion. If you use the lisp mechanisms (either
with frs_push or with the macros to implement UNWIND-PROTECT), then you
can also get exceptions, but the lisp environment remains at all times
consistent (variable bindings are undone, stacks are properly restored,
Maybe if ECL had been implemented in C++, things would have been
different, but right now the setjmp/longjmp mechanism does what we want.
More information about the ecl-devel