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 7172ABC69 for ; Wed, 28 Mar 2007 13:33:51 +0200 (CEST) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.173]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l2SBXooa010611 for ; Wed, 28 Mar 2007 13:33:51 +0200 Received: by ug-out-1314.google.com with SMTP id k3so204380ugf for ; Wed, 28 Mar 2007 04:33:50 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:mime-version:content-transfer-encoding:message-id:content-type:to:from:subject:date:x-mailer; b=df5wFZpAMMCS6MimGMmD345O8WnkFGCRRNOOBq0vu99yXSFLvs5CWTapr+5KvmbJFfuNGrTR4SA5ZQ7z58o8hSzRUxSl84HxKKW6fIWaIZnLBQaN5sS9Dh8h8DkCmgfpMHucCTo1wIZOSqYm9SFG+iUklxrMGuCFBgSybD2EUds= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:mime-version:content-transfer-encoding:message-id:content-type:to:from:subject:date:x-mailer; b=IWKyW12n/zWDSZI8KNJQ7Djkhe3iAAiadUqkhDGAx5IBxAcathC0Mg1926nctEGjvpAozfF2USvsc31XHQomaXIn7mGv8xp1LpNq8UT4B11/Sxw1GEtiMWAl1kvlMhXdaQ7eFifrIDhqiIZySLhAPG0KxriYfHJLuod1X+WYens= Received: by 10.67.71.15 with SMTP id y15mr350752ugk.1175081630924; Wed, 28 Mar 2007 04:33:50 -0700 (PDT) Received: from ?192.168.1.34? ( [88.7.141.133]) by mx.google.com with ESMTP id s7sm829283uge.2007.03.28.04.33.49; Wed, 28 Mar 2007 04:33:50 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v752.3) Content-Transfer-Encoding: 7bit Message-Id: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: Caml List From: Joel Reymont Subject: Wrapping OCaml function returning a variant Date: Wed, 28 Mar 2007 12:33:46 +0100 X-Mailer: Apple Mail (2.752.3) X-j-chkmail-Score: MSGID : 460A529F.000 on discorde : j-chkmail score : XXX : 5/20 1 0.000 -> 3 X-Miltered: at discorde with ID 460A529F.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 int:01 int:01 strings:01 strings:01 variant:02 variant:02 output:02 string:02 string:02 allocated:03 allocated:03 somewhere:06 suggestions:07 Is there an example of returning a variant from OCaml into C somewhere? It's a regular variant, declared like this type morpher_output = | Success of string | Error of string * int * int * int The other issue is that I don't know how to deal with strings allocated in OCaml. Will they be collected automatically? The strings _must_ be allocated in OCaml but I can guarantee that they will not be modified in the C code. Any suggestions on how to deal with this? Thanks, Joel -- http://wagerlabs.com/