[haiku-development] Re: Scripting languages

  • From: Ryan Leavengood <leavengood@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Mon, 16 May 2011 12:20:29 -0400

On Mon, May 16, 2011 at 11:15 AM, Donn Cave <donn@xxxxxxxxxxx> wrote:
>
> http://www.haskell.org/haskellwiki/Cxx%5Fforeign%5Ffunction%5Finterface
>
> I took the approach described there as "seems to be the standard
> technique", essentially a C wrapper for everything.  I see someone
> has had enough success calling the mangled functions directly to
> offer a little writeup, but I imagine that would be a waste of time.
> In the end, you will want the wrappers anyway for type conversions,
> pointer dereferences etc.

With the recent work of Jon Yoder (aka darkwyrm) on
libcharlemagne[1,2], which may become the "standard" Haiku C API
wrapper, doing the above with Haskell (and other languages for that
matter) may be easier now. In fact maybe you could share some of your
work on a BeOS C API wrapper as it may be useful for Jon for
libcharlemagne.

FYI Sean: my plan for doing a Ruby Haiku API wrapper would be to use
Rubinius (one particular Ruby implementation which I find interesting)
and it's FFI (which is probably much like Haskell's) with
libcharlemagne. I think plain Ruby (known as MRI for Matz's Ruby
Implementation in the Ruby community) also has an FFI like Rubinius.
Though with MRI you can also just write C code to create Ruby code
around a C API.

Of course making one-to-one API bindings could also be automated,
either with custom code or with SWIG. Then one would probably want to
make a wrapper which is more in the style of the language in question.

1. 
http://paladin.hg.sourceforge.net/hgweb/paladin/paladin/file/4da38dbd477c/libcharlemagne/
2. http://darkwyrm-haiku.blogspot.com/2011/01/c-meet-haiku-gui.html

-- 
Regards,
Ryan

Other related posts: