Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Mathias Kende <mathias@kende.fr>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Question about CAMLparamx macros
Date: Thu, 10 Apr 2008 18:49:55 +0200	[thread overview]
Message-ID: <47FE4533.5090402@kende.fr> (raw)
In-Reply-To: <47FE3E65.7030907@rice.edu>


Raj Bandyopadhyay a écrit :
> Do I have to use the CAMLparamx/CAMLlocalx/CAMLreturnx macros in the 
> above cases? Would it cause problems if I used them anyway?

You should at least use these macros when the GC may be triggered during your C 
function (e.g. with calls to some of the alloc_ functions) and you have local 
"value", even if your function does not accept value as argument and/or does not 
return a "value" variable.

 > value foo(int x){
 >    return caml_callback();
 > }
 >
 > should be replaced by
 >
 > value foo(int x){
 >    CAMLparam0();
 >    CAMLreturn(caml_callback());
 > }

I believe that the first is correct, but I am not a real guru of this Ocaml-C 
binding, so I am not sure of this.

Mathias


  reply	other threads:[~2008-04-10 16:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-10 16:20 Raj Bandyopadhyay
2008-04-10 16:49 ` Mathias Kende [this message]
2008-04-10 17:48 ` [Caml-list] " Richard Jones
2008-04-11 13:42 ` Damien Doligez

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=47FE4533.5090402@kende.fr \
    --to=mathias@kende.fr \
    --cc=caml-list@yquem.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