From: Erik de Castro Lopo <mle+ocaml@mega-nerd.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] C wrappers and callbacks from Ocaml to C and back to Ocaml
Date: Fri, 7 Aug 2009 14:23:42 +1000 [thread overview]
Message-ID: <20090807142342.5ed13aac.mle+ocaml@mega-nerd.com> (raw)
In-Reply-To: <87r5voa4y1.fsf@frosties.localdomain>
Goswin von Brederlow wrote:
> Well, you just do. A structure is a value like anything else.
Yes, with a bit of careful debugging I managed to get a bit further
and even managed to extract (in the C code) the Ocaml function from
the Ocaml struct and I think I can call it, but I haven't test that
yet.
> What you have to watch out for is the GC.
This is what I was worried about :-).
> If you store the value
> somewhere then you have to tell the GC about it by registering it as a
> new root. And when you are done with it you need to unregister it.
Ah yes, the following two functions in <caml/memory.h>:
CAMLextern void caml_register_global_root (value *);
CAMLextern void caml_remove_global_root (value *);
Cheers,
Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
prev parent reply other threads:[~2009-08-07 4:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-06 21:17 Erik de Castro Lopo
2009-08-06 23:38 ` [Caml-list] " Goswin von Brederlow
2009-08-07 4:23 ` Erik de Castro Lopo [this message]
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=20090807142342.5ed13aac.mle+ocaml@mega-nerd.com \
--to=mle+ocaml@mega-nerd.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