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=1.0 required=5.0 tests=AWL,SPF_NEUTRAL 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 A8787BC69 for ; Wed, 28 Mar 2007 14:13:44 +0200 (CEST) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.172]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l2SCDiCq019065 for ; Wed, 28 Mar 2007 14:13:44 +0200 Received: by ug-out-1314.google.com with SMTP id k3so214885ugf for ; Wed, 28 Mar 2007 05:13:44 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; b=YTd+islH2LmHtn9sydNGRaQBpGdk/HmnuU5Zcb/Qo9XvBkm/eDRE54L9oTIidXAGV7Hq8uHQ20VYUO0KV9euDM3O30rgTyScyMXvJPO7/oqeNyRUtUmHzHuldm0uSnBAQSEc+o8VdYdXsQlmhwQIRjS4QU7Ew4MwmPMcjDAs91Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; b=n7MaSNIn+/K6zF9FHIC1i6ElSkniSiwv2DkrZAnXQhXnEWR/M1yKi2LVyOl50jL3X7O2kB07yf3bVj0eiIoGFbsRGpFW4UWB1q0aJeSmUzkdf30EtWrm58KVgbrlH325uneX5ST562fuaRXVQz0fBYfchRCxeDmxOmXFH8mndpY= Received: by 10.67.30.6 with SMTP id h6mr372072ugj.1175084024098; Wed, 28 Mar 2007 05:13:44 -0700 (PDT) Received: from ?192.168.1.34? ( [88.8.239.112]) by mx.google.com with ESMTP id 55sm867753ugq.2007.03.28.05.13.42; Wed, 28 Mar 2007 05:13:43 -0700 (PDT) In-Reply-To: <460A65AB.8020902@hq.idt.net> References: <460A65AB.8020902@hq.idt.net> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: Caml List Content-Transfer-Encoding: 7bit From: Joel Reymont Subject: Re: [Caml-list] Wrapping OCaml function returning a variant Date: Wed, 28 Mar 2007 13:13:40 +0100 To: Serge Aleynikov X-Mailer: Apple Mail (2.752.3) X-j-chkmail-Score: MSGID : 460A5BF8.001 on discorde : j-chkmail score : XXX : 5/20 1 0.000 -> 3 X-Miltered: at discorde with ID 460A5BF8.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 alloc:01 ocaml's:01 ocaml:01 28,:98 2007,:98 heap:01 heap:01 garbage:01 wrote:01 caml-list:01 strings:01 strings:01 variant:02 caml:02 On Mar 28, 2007, at 1:55 PM, Serge Aleynikov wrote: > If you are using caml_copy_string() or caml_alloc_string() they > allocate strings on OCaml's heap, and will be automatically garbage > collected. How do I pass a C string into OCaml if the assumption is that it will not be modified? Do I still need to copy it with caml_copy_string? I don't think I need to allocate strings on the OCaml heap from C as the string given to OCaml will be allocated on the C heap and the string returned from OCaml will be garbage-collected automatically. Thanks, Joel -- http://wagerlabs.com/