caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Exception is not caught by callback3_exn()
@ 2000-05-22 19:15 Richard Samuels
  2000-05-23  8:18 ` Xavier Leroy
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Samuels @ 2000-05-22 19:15 UTC (permalink / raw)
  To: caml-list

I'm calling an ocaml function from C, with the following statements:

{  ... /* setup args */

   if (fn_closure == NULL)
     fn_closure = caml_named_value ("fn");

   answer = callback3_exn(*fn_closure,
		     Caml_rep, Caml_tofile, Caml_codefile);

   if ( Is_exception_result( answer ) ) {
     retval = NULL;
     CAMLreturn( retval );
   }

   if (Is_block(answer)) {
	... /* handle result */
   }
}

Using callback3_exn should catch any exceptions thrown in the code and 
return. However, when the caml code throws an exception, my code doesn't 
get control and the program terminates! I don't understand what's wrong 
here -- could somebody please help?

Thanks,

Richard Samuels
rls25@cornell.edu




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Exception is not caught by callback3_exn()
  2000-05-22 19:15 Exception is not caught by callback3_exn() Richard Samuels
@ 2000-05-23  8:18 ` Xavier Leroy
  0 siblings, 0 replies; 2+ messages in thread
From: Xavier Leroy @ 2000-05-23  8:18 UTC (permalink / raw)
  To: Richard Samuels, caml-list

> Using callback3_exn should catch any exceptions thrown in the code and 
> return. However, when the caml code throws an exception, my code doesn't 
> get control and the program terminates! I don't understand what's wrong 
> here -- could somebody please help?

Works fine here (in OCaml 3.00).  Make sure you use OCaml version 2.03
or later, since the initial implementation of callback*_exn in 2.02
was buggy.

If that doesn't explain your problem, please write caml-bugs@inria.fr
or use the bug-tracking system on our Web site and send us a complete
example reproducing the problem.

- Xavier Leroy




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-05-24  8:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-22 19:15 Exception is not caught by callback3_exn() Richard Samuels
2000-05-23  8:18 ` Xavier Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).