English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
How to wrap around C++?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-02-08 (02:13)
From: Luca de Alfaro <luca@d...>
Subject: How to wrap around C++?
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

How can I wrap around such an object in Ocaml?  Is it possible?  Any

Many thanks,