caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Marek Kubica <marek@xivilization.net>
To: caml-list@inria.fr
Subject: [Caml-list] C interop: Return values in parameters
Date: Sun, 30 Dec 2012 14:08:23 +0100	[thread overview]
Message-ID: <20121230140823.20f39bcd@xivilization.net> (raw)

Hi,

I am trying to wrap a C library in OCaml but I don't know how to do
this particular thing:

I have a library that looks roughly like this:

int function(void** ptr);

So I get an int as return value to show whether the function succeeded
and it *sets* the ptr.

void* ptr;
function(&ptr);
// ptr is different now

How can I wrap such a function in OCaml? When I call my OCaml wrapper

let retval = function ptr in
    ...

the pointer does not get updated. Is there a function in the C API to
force OCaml to update the values?

regards,
Marek

             reply	other threads:[~2012-12-30 13:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-30 13:08 Marek Kubica [this message]
2012-12-30 14:01 ` Török Edwin
2012-12-30 14:19   ` Marek Kubica
2012-12-30 14:36     ` Gabriel Scherer
2012-12-31  1:48       ` Marek Kubica

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=20121230140823.20f39bcd@xivilization.net \
    --to=marek@xivilization.net \
    --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).