From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA26090; Wed, 7 Jul 2004 11:24:51 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA26229 for ; Wed, 7 Jul 2004 11:24:50 +0200 (MET DST) Received: from annexia.force9.co.uk (annexia.force9.co.uk [212.56.101.183]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i679OeSH017634 for ; Wed, 7 Jul 2004 11:24:46 +0200 Received: from rich by annexia.force9.co.uk with local (Exim 3.36 #1 (Debian)) id 1Bi8en-0005S8-00; Wed, 07 Jul 2004 10:24:01 +0100 Date: Wed, 7 Jul 2004 10:24:01 +0100 To: Claudio Trento Cc: caml-list@inria.fr Subject: Re: [Caml-list] How OCaml objects of sum types can be passed to a C/C++ functions? Message-ID: <20040707092401.GA20830@redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.5.1+cvs20040105i From: Richard Jones X-Miltered: at concorde with ID 40EBC158.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 2004:99 trento:99 interfacing:01 expr:01 expr:01 uminus:01 team's:01 ltd:98 htmlman:01 ocaml:01 ocaml:01 caml:01 int:01 int:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wed, Jul 07, 2004 at 10:56:04AM +0200, Claudio Trento wrote: > > on the subject of interfacing OCaml with C/C++, it is not clear > to me whether and how OCaml objects of sum types can be passed > to a C/C++ function. For example, suppose I have the declaration > > type expr = > Variable of int > | Coefficient of int > | UPlus of expr > | UMinus of expr > | Sum of (expr * expr) > | Difference of (expr * expr) > | Product of (expr * expr) > > What is the best way to pass an expr object to C/C++? > How can C/C++ code visit such a structure? > Many thanks for your time and patience, This section in the manual: http://caml.inria.fr/ocaml/htmlman/manual032.html#htoc217 contains a rather unclear explanation. Rich. -- Richard Jones. http://www.annexia.org/ http://www.j-london.com/ Merjis Ltd. http://www.merjis.com/ - improving website return on investment 'There is a joke about American engineers and French engineers. The American team brings a prototype to the French team. The French team's response is: "Well, it works fine in practice; but how will it hold up in theory?"' ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners