English version
Accueil propos Tlchargement Ressources Contactez-nous

Ce site est rarement mis jour. Pour les informations les plus rcentes, rendez-vous sur le nouveau site OCaml l'adresse ocaml.org.

Browse thread
CAMLreturn does not work for floats between 0 and 1 ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-02-16 (17:02)
From: Mathias Kende <mathias@k...>
Subject: Re: [Caml-list] CAMLreturn does not work for floats between 0 and 1 ?
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.


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