Raj Bandyopadhyay wrote:
Hi ocaml folks

I have a C program that makes callbacks to the OCaml runtime via the callback_exn() mechanism. Unfortunately, the OCaml code is raising some exception. It seems to be one of the built-in OCaml exceptions, and not something that I have defined in my OCaml code.

I would like to know what is the easiest/correct way to identify the exact OCaml exception being raised, so I can debug this program.

You can use the macros Is_exception_result and Extract_exception (defined in callback.h) to check whether the result of callback_exn is an exception and to retrieve the exception value in that case. The first field of this value points to a block with one field pointing to the string representing the exception's constructor name. The other fields of the exception value are the exception's arguments.

-- Alain

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to