caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Mathias Kende <mathias@kende.fr>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] CAMLreturn does not work for floats between 0 and 1 ?
Date: Fri, 16 Feb 2007 18:02:25 +0100	[thread overview]
Message-ID: <1171645345.16321.13.camel@MATHIAS-ENS> (raw)
In-Reply-To: <45D5D9DC.8050704@laposte.net>

If you're writing a function called by OCaml, then you should use
CAMLparam and CAMLreturn macros (and the function will take only
parameters of type value (and one at least)). But if your function is
called by C code then it must follows the normal convention.

To send a value to Caml (with caml_callback for exemple) you should
create it with the Val_* functions if it is a simple block (int or bool)
or with the caml_alloc* ones in other cases.

Sincerely.
Mathias

Le vendredi 16 février 2007 à 17:20 +0100, Matthieu Dubuget a écrit :
> Daniel Bünzli a écrit :
> >
> > Le 16 févr. 07 à 15:46, Matthieu Dubuget a écrit :
> >
> >> I'm sure I'm doing something bad. But I can't find out where?
> >
> > CAMLreturn and CAMLparam0 macros are used in functions that are called
> > from ocaml land and return a value in ocaml land. You should not use
> > them for your functions called in C land and returning a value in C
> > land (see section 18.7.2 of the manual).
> OK. Thanks. But this is not all clear for me.
> 
> Suppose that I have to construct one or more value(s) to pass them to
> OCaml land. I do have to use CAMLlocal macros for that, don't I.
> Can use them without CAMLparam and CAMLreturn macros?
> 
> Salutations
> 
> Matt
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs


  reply	other threads:[~2007-02-16 17:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-16 14:46 Matthieu Dubuget
2007-02-16 15:09 ` [Caml-list] " Daniel Bünzli
2007-02-16 16:20   ` Matthieu Dubuget
2007-02-16 17:02     ` Mathias Kende [this message]
2007-02-16 17:07     ` Daniel Bünzli
2007-02-16 19:19       ` Matthieu Dubuget
2007-02-16 22:28         ` Daniel Bünzli
2007-02-17  0:30 ` Jacques Garrigue

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=1171645345.16321.13.camel@MATHIAS-ENS \
    --to=mathias@kende.fr \
    --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).