From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 E7926BC37 for ; Mon, 8 Feb 2010 03:13:43 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Au0BADcCb0tKfVwZkGdsb2JhbACbAjwBAQEBCQkMBxMDuluEVAQ X-IronPort-AV: E=Sophos;i="4.49,425,1262559600"; d="scan'208";a="51858108" Received: from qw-out-2122.google.com ([74.125.92.25]) by mail1-smtp-roc.national.inria.fr with ESMTP; 08 Feb 2010 03:13:43 +0100 Received: by qw-out-2122.google.com with SMTP id 5so534833qwi.33 for ; Sun, 07 Feb 2010 18:13:42 -0800 (PST) MIME-Version: 1.0 Received: by 10.229.106.21 with SMTP id v21mr399980qco.12.1265595222685; Sun, 07 Feb 2010 18:13:42 -0800 (PST) X-Originating-IP: [216.239.44.65] Date: Sun, 7 Feb 2010 18:13:42 -0800 Message-ID: <28fa90931002071813k7330ad34s7a2ec8b4cf1c3d11@mail.gmail.com> Subject: How to wrap around C++? From: Luca de Alfaro To: Inria Ocaml Mailing List Content-Type: multipart/alternative; boundary=001fc6d692f3ad78c6047f0d5962 X-Spam: no; 0.00; ocaml:01 ocaml:01 implements:01 implements:01 functions:01 functions:01 essentially:02 essentially:02 namely:02 namely:02 luca:04 luca:04 complex:05 complex:05 examples:07 --001fc6d692f3ad78c6047f0d5962 Content-Type: text/plain; charset=ISO-8859-1 I need to be able to call some C++ functions from my Ocaml code. Can someone point me to some examples on how this is done? Is it an issue if what I need to wrap is C++, rather than the more standard C? I also would like to know if I can do something more complex... namely, I would like to create a C++ object, and return it to Ocaml. Ocaml then needs to be able to call methods of that object. The object does not need to be directly accessible from Ocaml, but it needs to be persistent, so that all Ocaml calls refer to the same object. Essentially, the C++ object implements access to a file via some compression, etc, mechanism. In C++, one creates the object, calls write and read methods, calls the method for closing the file, and deletes the object. How can I wrap around such an object in Ocaml? Is it possible? Any advice? Many thanks, Luca --001fc6d692f3ad78c6047f0d5962 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I need to be able to call some C++ functions from my Ocaml code.=A0
Can= someone point me to some examples on how this is done? =A0Is it an issue i= f what I need to wrap is C++, rather than the more standard C?=A0

I also would like to know if I can do something more complex... = namely, I would like to create a C++ object, and return it to Ocaml.=A0
Ocaml then needs to be able to call methods of that object. =A0The o= bject does not need to be directly accessible from Ocaml, but it needs to b= e persistent, so that all Ocaml calls refer to the same object.=A0

Essentially, the C++ object implements access to a file= via some compression, etc, mechanism. =A0In C++, one creates the object, c= alls write and read methods, calls the method for closing the file, and del= etes the object.=A0

How can I wrap around such an object in Ocaml? =A0Is it= possible? =A0Any advice?=A0

Many thanks,=A0
=

Luca

--001fc6d692f3ad78c6047f0d5962--