caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] C Interface question about failwith
@ 2013-03-01 11:06 Christoph Bauer
  2013-03-01 11:11 ` Romain Bardou
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Bauer @ 2013-03-01 11:06 UTC (permalink / raw)
  To: caml-list

Hi,

In C code I have a malloced-string error message, which must be freed. But I want also raise an OCaml exception
with this string. Actually what I need something like this:

static
void failwith_string_value(value msg)
{
  CAMLparam1(msg);
  caml_raise_with_arg(Field(caml_global_data, FAILURE_EXN), msg);
  CAMLnoreturn;
}

Then I could do:

  
     msg = caml_copy_string(s);
    free(s);
    failwith_string_value(msg);


But FAILURE_EXN is not defined in fail.h and more important
caml_global_data is defined in mlvalues.h, but I get an undefined reference link error.

Any ideas how to solve such a problem?

Thanks,
Christoph Bauer

    



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

end of thread, other threads:[~2013-03-01 11:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-01 11:06 [Caml-list] C Interface question about failwith Christoph Bauer
2013-03-01 11:11 ` Romain Bardou
2013-03-01 11:40   ` Christoph Bauer

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).