Version française
Home     About     Download     Resources     Contact us    
Browse thread
wrapping c++
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: ygrek <ygrekheretix@g...>
Subject: Re: [Caml-list] wrapping c++
On Mon, 20 Dec 2010 22:16:44 +0000
Joel Reymont <joelr1@gmail.com> wrote:

> Are there any recipes for wrapping a large C++ class that uses callbacks?

All the same as C bindings. But using C++ features one can reduce the
amount of boilerplate needed. E.g. see http://ygrek.org.ua/p/code/cxx_wrapped/cxx_wrapped.h
for a simple template class to wrap C++ objects as ocaml custom values (bindings to non-trivial
C++ lib will probably need wrapping smart_ptr's as well). Also simple tricks
like RAII for blocking_section save some typing. But all in all it is the same
manual translation.

-- 
 ygrek
 http://ygrek.org.ua