From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id D515EBBAF for ; Mon, 15 Feb 2010 17:45:58 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEANoIeUugTqeM/2dsb2JhbACbGnS9B4RbBI4k X-IronPort-AV: E=Sophos;i="4.49,478,1262559600"; d="scan'208";a="44686878" Received: from spartacus.cs.unipr.it ([160.78.167.140]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 15 Feb 2010 17:45:58 +0100 Received: from [192.168.1.212] (host156-138-dynamic.57-82-r.retail.telecomitalia.it [82.57.138.156]) (authenticated bits=0) by spartacus.cs.unipr.it (8.14.3/8.14.3) with ESMTP id o1FGjpkF011814 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Mon, 15 Feb 2010 17:45:53 +0100 Message-ID: <4B797A3E.5060304@cs.unipr.it> Date: Mon, 15 Feb 2010 17:45:50 +0100 From: Roberto Bagnara Organization: Department of Mathematics, University of Parma, Italy User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050929 Thunderbird/1.0.7 Fedora/1.0.7-1.1.fc4 Mnenhy/0.7.3.0 MIME-Version: 1.0 To: Jean Yang Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Calling C++ from OCaml References: <1bd843011002150832k54f53d8fme371dd7593703001@mail.gmail.com> In-Reply-To: <1bd843011002150832k54f53d8fme371dd7593703001@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.1.1 (spartacus.cs.unipr.it [160.78.167.140]); Mon, 15 Feb 2010 17:45:54 +0100 (CET) X-Spam: no; 0.00; ocaml:01 ocaml:01 ocaml's:01 ocamlc:01 wrote:01 caml-list:01 functions:01 functions:01 interfaces:01 interfaced:02 external:03 library:03 applied:05 laboratory:06 interface:06 On 02/15/10 17:32, Jean Yang wrote: > I've been trying to call C++ from OCaml by using OCaml's external C > interface to call C functions that call the mangled-name version of the > C++ functions. I've been running into trouble because I'm not sure how > to specify the C++ object files to link against with ocamlc. (I'm not > sure how to do it using ocaml-make.) Can anyone help? > > Also, is this the best way to call from OCaml to C++? I am not sure what is the best way to call C++ code from OCaml. However, we successfully interfaced the Parma Polyhedra Library core, which is written in C++, to OCaml. You can fetch a source distribution from http://www.cs.unipr.it/ppl/ and look into the interfaces/OCaml directory. Hope it helps, Roberto -- Prof. Roberto Bagnara Applied Formal Methods Laboratory Department of Mathematics, University of Parma, Italy http://www.cs.unipr.it/~bagnara/ mailto:bagnara@cs.unipr.it