[Haskell-cafe] FFI question
Duncan Coutts
duncan.coutts at worc.ox.ac.uk
Thu Feb 9 12:45:01 EST 2006
On Thu, 2006-02-09 at 09:27 -0800, Donn Cave wrote:
> On Thu, 9 Feb 2006, Christopher Brown wrote:
> > Frederico,
> >
> > Have you tried using Green Card?
> >
> > http://haskell.org/greencard/
> >
> > It is basically a foreign function pre-processor for Haskell. It
> > allows your Haskell programs to interface with C libraries in a very
> > straight forward way.
>
> I tried it, and managed to get it working to some extent. Then
> I found out about hsc2hs and the current FFI support in ghc, and
> I noticed that according to http://www.haskell.org/greencard/ ,
> the current version of Green Card is an alpha release from 2003.
>
> >From comparison of the two, my impression is that this parrot is
> dead, and everyone is just too polite to say so. Unfortunately,
> this inability to pull the shades on Green Card, Haskell Direct,
> etc., takes away a little from ghc's outstanding FFI.
There is also c2hs which is well supported and is used for several large
C bindings:
http://www.cse.unsw.edu.au/~chak/haskell/c2hs/
It works at a higher level than hsc2hs and can make writing bindings
quite a bit simpler and cleaner. For example the cairo bindings use it:
http://darcs.haskell.org/gtk2hs/cairo/Graphics/Rendering/Cairo/
see the various .chs files, for example:
http://darcs.haskell.org/gtk2hs/cairo/Graphics/Rendering/Cairo/Internal/Drawing/Paths.chs
Duncan
More information about the Haskell-Cafe
mailing list