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
question about how to bind c++ classes to ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-08-14 (07:17)
From: Michael Wohlwend <micha-1@f...>
Subject: Re: [Caml-list] question about how to bind c++ classes to ocaml

-------- Original-Nachricht --------
Datum: Mon, 14 Aug 2006 09:20:46 +0900 (JST)
Von: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
An: micha-1@fantasymail.de
Betreff: Re: [Caml-list] question about how to bind c++ classes to ocaml

> Calls from ocaml to C are very cheap. If your access function doesn't
> do any allocation (i.e. never calls the GC), you can even make it
> faster by marking it as "noalloc". Beware many functions do
> allocate, including copy_double or copy_string.

thanks for pointing this out. The "noalloc"-thing isn't really described in the docu? :-)

Another question which came up was: you can only declare normal functions (not methods) as "external", so you have to write a c function for every c++ member function. Do you rebuild the inheritance hierachy somehow through the type system (maybe with those mysterious phantom types?) or just put an ocaml class system on top of it?


ps: I know there is the gtk binding, but understanding the complete source is... not that easy :-)

Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer