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 mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id D92DDBBAF for ; Mon, 15 Feb 2010 17:32:40 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aj4DAFcFeUvRVd22kGdsb2JhbACFdIk2ixdRCBUBAQEBCQkMBxMDILBGP4MzIohQAQEDBYRWBIMUiHU X-IronPort-AV: E=Sophos;i="4.49,478,1262559600"; d="scan'208";a="52782631" Received: from mail-qy0-f182.google.com ([209.85.221.182]) by mail1-smtp-roc.national.inria.fr with ESMTP; 15 Feb 2010 17:32:40 +0100 Received: by qyk12 with SMTP id 12so2543590qyk.21 for ; Mon, 15 Feb 2010 08:32:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=7/ac2Xs9nkzwxS1zMrMvnwwJmC87U4luNmsCL326hA4=; b=ewrkyHkYLueq6wjnQXNUs12m5+B2bVSpmt1mB398Z6Wsmbg0pMjKEgdvfQW3cUA6Qw 9lJMk0hqrXq9SiOOU15HW3aQrVehrq2kngUi5P6Jneu2+NSXrMaFpYkFnfcc0aKcETJd lBHjxpDhDZ+I/tfOvs3Ygzp+Jge+75tv63snc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=tkS6k75bdVIDO0tWVkLiuqiXUd/GFW7AGq0uh8cXV3xTunN0kuGuEx16EY5O02aGgf OA9xjZZxj9sP+DlO2qSr7bJgPeZ/FN0Erx3wo+gT1QQS8DA0/vl7YHD+fBmGN+D64xpE GzHuh/u+dhPBmTNCdfgA0LpuliQ4Cru1Z4XWc= MIME-Version: 1.0 Sender: jean.yang.writeme@gmail.com Received: by 10.229.189.212 with SMTP id df20mr608215qcb.21.1266251552366; Mon, 15 Feb 2010 08:32:32 -0800 (PST) Date: Mon, 15 Feb 2010 11:32:31 -0500 X-Google-Sender-Auth: 4a7120e727dfaf35 Message-ID: <1bd843011002150832k54f53d8fme371dd7593703001@mail.gmail.com> Subject: Calling C++ from OCaml From: Jean Yang To: caml-list@yquem.inria.fr Content-Type: multipart/alternative; boundary=0016362849befa895c047fa629fd X-Spam: no; 0.00; ocaml:01 ocaml:01 ocaml's:01 ocamlc:01 ocaml's:01 ocamlc:01 functions:01 functions:01 external:03 external:03 interface:06 interface:06 specify:06 specify:06 i'm:09 --0016362849befa895c047fa629fd Content-Type: text/plain; charset=ISO-8859-1 Hello, 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++? Thanks, Jean -- Jean Yang http://people.csail.mit.edu/jeanyang Save us! Think before you print. --0016362849befa895c047fa629fd Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello,

=A0 I've been trying to call C++ from OCaml by using OCam= l's external C interface to call C functions that call the mangled-name= version of the C++ functions.=A0 I've been running into trouble becaus= e I'm not sure how to specify the C++ object files to link against with= ocamlc.=A0 (I'm not sure how to do it using ocaml-make.)=A0 Can anyone= help?

=A0 Also, is this the best way to call from OCaml to C++?

Thanks= ,
Jean

--
Jean Yang
http://people.csail.mit.edu/jeanyang
Save u= s! =A0Think before you print.
--0016362849befa895c047fa629fd-- 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