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.4 required=5.0 tests=SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 4E0E9BC69 for ; Wed, 22 Aug 2007 09:24:39 +0200 (CEST) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.238]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l7M7Ocv5011340 for ; Wed, 22 Aug 2007 09:24:38 +0200 Received: by nz-out-0506.google.com with SMTP id x7so44869nzc for ; Wed, 22 Aug 2007 00:24:38 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ddq22EUIpQANHdeeJq6ltvEr2371gb+KMltvHlvatbM0BWdbtwNtFasUvuHyZtIwOvMVRSxxISj8v/KO9mXjH2oRAsOp26phgDjCKd3Qvp4MGhgAMSdkRYttWkOZ7Px6sR9B4U4yuESQD3X2wcFgSQaIOIezcOX4S/dGEOS/I/o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=EgtsbKR89z99d8QkBaeKc3lr2ZDQF/yuML4GUQV23RcxX3SMCYnUBlYw9/2NxoQOSl8xu8LU9ZNR/2FOeh/jrzbriU9WqTYmHpxSDfnszehlTD9QncDfvrLQu8CPUn0L9S4CMeDIulHx6iK3HB+CXz+SV6JjKe7Dr/SxPaLgzRs= Received: by 10.114.200.2 with SMTP id x2mr376716waf.1187767477103; Wed, 22 Aug 2007 00:24:37 -0700 (PDT) Received: by 10.114.57.9 with HTTP; Wed, 22 Aug 2007 00:24:36 -0700 (PDT) Message-ID: <95513600708220024n247a1068rd9277521ffcb708d@mail.gmail.com> Date: Wed, 22 Aug 2007 09:24:37 +0200 From: "Olivier Andrieu" To: "andrew.p.cone" Subject: Re: [Caml-list] Returning caml values from C Cc: caml-list@yquem.inria.fr In-Reply-To: <12264892.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <12264892.post@talk.nabble.com> X-j-chkmail-Score: MSGID : 46CBE4B6.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 46CBE4B6.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; andrieu:01 oandrieu:01 alloc:01 segfault:01 camlparam:01 wrote:01 caml-list:01 macros:01 caml:02 caml:02 manual:06 inria:06 229:06 olivier:07 olivier:07 On 8/22/07, andrew.p.cone wrote: > > Hi everybody. > > I have a C function that, given a list of caml values, returns a certain > sublist of those values. > > Currently, I have the C code build up a caml list using caml_alloc and > Store_field. But when I try to access those values in caml, I get a > segfault. > > I suspect the GC is deleting the input list, because it doesn't realize I've > made something new that refers to some of those values. How do I tell the GC > that something refers to some value? by registering the value with the macros CAMLparam* and CAMLlocal* cf. http://caml.inria.fr/pub/docs/manual-ocaml/manual032.html#htoc229 -- Olivier