From: Richard Jones <rich@annexia.org>
To: "Daniel Bünzli" <daniel.buenzli@epfl.ch>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Wrapping a callback to OCaml code from C
Date: Fri, 24 Jun 2005 12:23:27 +0100 [thread overview]
Message-ID: <20050624112327.GA26602@furbychan.cocan.org> (raw)
In-Reply-To: <5CDC7A78-EE85-4C7E-A630-8CED51F8B614@epfl.ch>
On Fri, Jun 24, 2005 at 01:15:16PM +0200, Daniel Bünzli wrote:
>
> Le 24 juin 05 à 12:40, Richard Jones a écrit :
>
> >On Thu, Jun 23, 2005 at 10:47:33PM +0100, Richard Jones wrote:
> >[...]
> >
> >There was quite a delay in this posting appearing. In the meantime I
> >think I've fixed the problem by adding CAMLparam0 .. CAMLlocal3 ..
> >CAMLreturn0 around the callback wrapper function.
>
> I would like to understand why this is needed. Did you allocate
> something with the gc in your Val_obj functions ?
Yes. Val_obj is in fact a thin wrapper around this function:
static inline value
Val_voidptr (void *ptr, const char *)
{
CAMLparam0 ();
CAMLlocal1 (rv);
rv = caml_alloc (1, Abstract_tag);
Field (rv, 0) = (value) ptr;
CAMLreturn (rv);
}
and of course callback_wrapper calls callback2 which calls into OCaml
code - rather a lot of allocation possibilities there!
Rich.
--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com
next prev parent reply other threads:[~2005-06-24 11:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-23 21:47 Richard Jones
2005-06-24 10:40 ` [Caml-list] " Richard Jones
2005-06-24 11:15 ` Daniel Bünzli
2005-06-24 11:23 ` Richard Jones [this message]
2005-06-24 11:38 ` Olivier Andrieu
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=20050624112327.GA26602@furbychan.cocan.org \
--to=rich@annexia.org \
--cc=caml-list@inria.fr \
--cc=daniel.buenzli@epfl.ch \
/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