FFI

Mark Conway Wirt mark@ArsConcero.org
Fri, 11 Jan 2002 10:46:57 -0500


I'm looking for opinions as to the best way to do a C (or C++)
foreign interface to GHC haskell code.

It looks like there are three options.  Greencard has been around for 
a while, but it looks as if it's more-or-less deprecated now; I don't
see many people talking about it anymore.  Unless I'm wrong about this
(and if I am, please disabuse me of this bias), it doesn't sound like
the obvious choice.

That leaves me with GHC's FFI and hdirect.  I've played around a bit
with hdirect in ghc-5.02 and it works.  I haven't really looked at the
native FFI (beyond reading some manual pages), so I'm not really sure
what hdirect provides that the FFI doesn't.  From a cursory glance it
looks like hdirect's ihc is useful for auto-generating interface files,
but it may be over-kill for my smallish project.

Any feedback or personal biases are welcomed.

Thanks,

--Mark