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 8EA6BBC69 for ; Wed, 28 Mar 2007 14:01:57 +0200 (CEST) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.175]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l2SC1vdE017075 for ; Wed, 28 Mar 2007 14:01:57 +0200 Received: by ug-out-1314.google.com with SMTP id k3so211766ugf for ; Wed, 28 Mar 2007 05:01:57 -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=Pwlb8VraUO4HSdi4UturJM5p5pl+9n0+zIGD8vxsM6svIwP06W953cJ7VxPvvhf2KQ2cXAX5gt5UZ8Yg/sh8ouijQ+nhJkqr0PZEsy2eEKE+TMqK9VAFM48XJlPXVlIiY4tJ+4267IvczRIrezrkRnjvFYk4gyfF5Bwx5jVm494= 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=pIFLuPKfizUQtcQPrQJ9CKrwNbAhXvRIt2PEr0ZXWFhMNbS44PzsNl0iXDYVrBO1WX8jXm96KJ/KtKM7RVsbBe2S3wgiJMB0FEs+i5aeM0aqlpLMkihs3exbzdbuVok1pJEHvgcoPRk6H95oRONjRVoISGuKhi4Be2TudLRq9C4= Received: by 10.67.23.5 with SMTP id a5mr367193ugj.1175083316621; Wed, 28 Mar 2007 05:01:56 -0700 (PDT) Received: from ?192.168.1.34? ( [88.8.239.112]) by mx.google.com with ESMTP id u6sm862162uge.2007.03.28.05.01.55; Wed, 28 Mar 2007 05:01:55 -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:01:52 +0100 To: Serge Aleynikov X-Mailer: Apple Mail (2.752.3) X-j-chkmail-Score: MSGID : 460A5935.000 on discorde : j-chkmail score : XXX : 5/20 1 0.000 -> 3 X-Miltered: at discorde with ID 460A5935.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 c-interface:01 variants:01 syntax:01 foo:01 syntax:01 variants:01 ocaml:01 28,:98 2007,:98 sourceforge:01 polymorphic:01 wrote:01 caml-list:01 int:01 On Mar 28, 2007, at 1:55 PM, Serge Aleynikov wrote: > You can read the section 18.3.4 of http://caml.inria.fr/pub/docs/ > manual-ocaml/manual032.html It does not clearly explain how to handle variant types in C code. Maybe I'm dumb but I did not understand it. > Then if still unclear, examine: http://oracaml.sourceforge.net/ > or any other C-interface library available on Caml Hump: http:// > caml.inria.fr/cgi-bin/hump.en.cgi?sort=0&browse=65 It looks like you are using polymorphic variants in new syntax. Maybe I'm wrong but it doesn't work for me # type foo = [Null | Int of int];; Syntax error I still don't understand how I can handle regular variants of the following type returned by OCaml to the C side > type morpher_output = > | Success of string > | Error of string * int * int * int Thanks, Joel -- http://wagerlabs.com/