From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=AWL,MISSING_HEADERS autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 4C7E6BC0A for ; Fri, 16 Feb 2007 18:02:35 +0100 (CET) Received: from nef2.ens.fr (nef2.ens.fr [129.199.96.40]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l1GH2Ygu005855 for ; Fri, 16 Feb 2007 18:02:35 +0100 Received: from clipper.ens.fr (clipper-gw.ens.fr [129.199.1.22]) by nef2.ens.fr (8.13.6/1.01.28121999) with ESMTP id l1GH2YuH088855 for ; Fri, 16 Feb 2007 18:02:34 +0100 (CET) X-Envelope-To: Received: from [129.199.158.192] (rezo-158-192 [129.199.158.192]) by clipper.ens.fr (8.13.1/jb-1.1) id l1GH2XhI003713 for ; Fri, 16 Feb 2007 18:02:33 +0100 (MET) Subject: Re: [Caml-list] CAMLreturn does not work for floats between 0 and 1 ? From: Mathias Kende Cc: caml-list@inria.fr In-Reply-To: <45D5D9DC.8050704@laposte.net> References: <45D5C3AD.2000606@laposte.net> <98085E4A-B42B-4570-90DC-842ABA89F5D6@epfl.ch> <45D5D9DC.8050704@laposte.net> Content-Type: text/plain; charset=UTF-8 Date: Fri, 16 Feb 2007 18:02:25 +0100 Message-Id: <1171645345.16321.13.camel@MATHIAS-ENS> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-milter (http://amavis.org/) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.1.4 (nef2.ens.fr [129.199.96.32]); Fri, 16 Feb 2007 18:02:34 +0100 (CET) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.9 (nef2.ens.fr [129.199.96.32]); Fri, 16 Feb 2007 18:02:34 +0100 (CET) X-Miltered: at discorde with ID 45D5E3AA.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlreturn:01 ocaml:01 camlparam:01 camlreturn:01 val:01 bool:01 alloc:01 0100,:01 matthieu:01 dubuget:01 matthieu:01 dubuget:01 camlparam:01 ocaml:01 beginner's:01 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