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.0 required=5.0 tests=none 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 A04FEBC6C for ; Fri, 16 Feb 2007 18:05:47 +0100 (CET) Received: from mail11.bluewin.ch (mail11.bluewin.ch [195.186.18.61]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l1GH5lBG006561 for ; Fri, 16 Feb 2007 18:05:47 +0100 Received: from [10.0.1.2] (85.2.30.249) by mail11.bluewin.ch (Bluewin 7.3.121) id 45C32878003DA411; Fri, 16 Feb 2007 17:05:47 +0000 In-Reply-To: <45D5D9DC.8050704@laposte.net> References: <45D5C3AD.2000606@laposte.net> <98085E4A-B42B-4570-90DC-842ABA89F5D6@epfl.ch> <45D5D9DC.8050704@laposte.net> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: <16855695-F439-47FB-80D1-171CD88833C2@epfl.ch> Cc: caml-list@inria.fr Content-Transfer-Encoding: quoted-printable From: =?ISO-8859-1?Q?Daniel_B=FCnzli?= Subject: Re: [Caml-list] CAMLreturn does not work for floats between 0 and 1 ? Date: Fri, 16 Feb 2007 18:07:32 +0100 To: matthieu.dubuget@laposte.net X-Mailer: Apple Mail (2.752.2) X-Miltered: at discorde with ID 45D5E46B.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; bunzli:01 buenzli:01 camlreturn:01 matthieu:01 dubuget:01 ocaml:01 camlparam:01 camlparam:01 camlreturn:01 ocaml:01 20,:98 invoke:01 caml-list:01 ints:01 macros:01 Le 16 f=E9vr. 07 =E0 17:20, Matthieu Dubuget a =E9crit : > 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. It depends. If you _allocate_ (e.g. ints are not allocated) a caml =20 value =13v1 then another caml v2 and then modify v1, you need to keep a =20= hand on v1 with CAMLparam because it may move when you allocate v2. =20 If you allocate only a single value then there is no need to do it =20 (unless some code you call may invoke the gc before you use v1). > Can use them without CAMLparam and CAMLreturn macros? No. But I never did the C -> ocaml -> C way so I don't really know =20 how to proceed. The first thing that comes to mind is to store the =20 result in a variable given to the function. void f1 (int i, double *result) { CAMLparam... *result =3D ... CAMLreturn0; } Maybe there's another way, I don't know. Daniel