Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Interface between Ocaml and C++
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Eray Ozkural <exa@k...>
Subject: Re: [Caml-list] Interface between Ocaml and C++
On Tuesday 22 June 2004 09:41, art yerkes wrote:
> On Mon, 21 Jun 2004 22:24:07 +0300
>
> Eray Ozkural <exa@kablonet.com.tr> wrote:
> > On Saturday 19 June 2004 10:29, art yerkes wrote:
> > > The SWIG module for Ocaml has support for a few STL
> > > types.  If you use those interfaces as a guide, you
> > > could add support for more if the automatic wrapping
> > > doesn't suit.
> > >
> > > SWIG isn't perfect for everyone but some needs are
> > > met very well, including using templates.
> > >
> > > Look at http://www.swig.org/
> >
> > How does it handle convert C++ templates to ocaml code, I wonder. I had a
> > design in my mind, but it required quite a bit of monkeying around.
> > What's their solution?
>
> The current solution is to specify which specializations of a given
> template will be needed, after which the specialized template classes are
> treated as ordinary classes.

OK. Imagine client ocaml code that uses template class C < T >. I had imagined 
that the specializations in the ocaml code ( C < int >, C < vector<float> 
>, ... ) could be determined automatically, after which the specializations 
are generated in C++ stub code, and linked in... So I guess I had in mind a 
more generic version of SWIG's approach, however I doubt this won't be a good 
mapping.... Can you guys imagine any other alternatives, or should we avoid 
templates in C++ libraries that want an ocaml binding (like KDE) ?

Cheers,

-- 
Eray Ozkural (exa) <erayo@cs.bilkent.edu.tr>
Comp. Sci. Dept., Bilkent University, Ankara  KDE Project: http://www.kde.org
http://www.cs.bilkent.edu.tr/~erayo  Malfunction: http://malfunct.iuma.com
GPG public key fingerprint: 360C 852F 88B0 A745 F31B  EA0F 7C07 AE16 874D 539C

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners