* Indentifying OCaml exceptions from C
@ 2008-04-30 15:52 Raj Bandyopadhyay
2008-05-01 7:46 ` [Caml-list] " Alain Frisch
0 siblings, 1 reply; 2+ messages in thread
From: Raj Bandyopadhyay @ 2008-04-30 15:52 UTC (permalink / raw)
To: caml-list
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.
Thank you
Raj
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] Indentifying OCaml exceptions from C
2008-04-30 15:52 Indentifying OCaml exceptions from C Raj Bandyopadhyay
@ 2008-05-01 7:46 ` Alain Frisch
0 siblings, 0 replies; 2+ messages in thread
From: Alain Frisch @ 2008-05-01 7:46 UTC (permalink / raw)
To: Raj Bandyopadhyay; +Cc: caml-list
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-05-01 7:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-30 15:52 Indentifying OCaml exceptions from C Raj Bandyopadhyay
2008-05-01 7:46 ` [Caml-list] " Alain Frisch
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).