Binding c++ gui libraries to haskell.

Forgot attachment. -- This is an short example program that uses the ffi to bind an fltk (www.fltk.org) call to haskell. Please give me your Makefile changes if you needed to change it. I'd like to get this gui-haskell ball rolling some more. David J. Sankel

On Thu, 27 Feb 2003 12:06:46 -0800 (PST)
David Sankel
This is an short example program that uses the ffi to bind an fltk (www.fltk.org) call to haskell. Please give me your Makefile changes if you needed to change it.
You great! :) Thanks, I needed this example. 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. Vincenzo

--- Nick Name
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 (http://www.cse.unsw.edu.au/~chak/haskell/ffi/ffi.pdf) 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 well. Anyway, good luck. Please post, if you can, anything you get working since I haven't seen anyone using this stuff yet. David J. Sankel
participants (2)
-
David Sankel
-
Nick Name