caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christoph Bauer <christoph.bauer@lmsintl.com>
To: caml-list <caml-list@inria.fr>
Subject: [Caml-list] C Interface question about failwith
Date: Fri, 1 Mar 2013 12:06:12 +0100	[thread overview]
Message-ID: <9A8556989A396A408C72088C69EDE56308AE441AFF@KAIP-EXMSG01.lmsintl.com> (raw)

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

    



             reply	other threads:[~2013-03-01 11:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-01 11:06 Christoph Bauer [this message]
2013-03-01 11:11 ` Romain Bardou
2013-03-01 11:40   ` Christoph Bauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9A8556989A396A408C72088C69EDE56308AE441AFF@KAIP-EXMSG01.lmsintl.com \
    --to=christoph.bauer@lmsintl.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).