[GUI] Binding c++ gui libraries to haskell.
Thu, 27 Feb 2003 17:19:21 -0800 (PST)
--- Nick Name <firstname.lastname@example.org> wrote:
> However, I am not sure I
> got the point: to wrap a C++ library, does one need
> to make a "CCALL"
> wrapper first? I guess that could be automatically
> generated. Have you
> already got ideas on how to deal with class methods
> and inheritance? If
> it's a silly question, I apologize.
Not a silly question at all. The ffi specification
does allow for a more direct connection to C++ using
cplusplus instead of ccall. However, this is not
standardized or implemented yet.
So the best we can do right now is use ccall
wrappers for C++ code. For classes and their
respective member functions, we may use ForeignPtr and
wrap the c++ call like this,
Foo_memFun_bar( Foo * someFoo, int i )
someFoo->bar( i );
and it would clearly work for inheritance.
It'd be nice to allow the pointer conventions used in
boost (www.boost.org) which would give us memory
management for the c++ side of things via shared_ptr.
I'm not sure how much can be done on this side of
things. Perhaps we can use boost::bind somehow as
Anyway, good luck. Please post, if you can, anything
you get working since I haven't seen anyone using this
David J. Sankel