FFI question -- was: [Haskell-cafe] New slogan for haskell.org

Gour ggdasa at gmail.com
Fri Dec 21 04:25:59 EST 2007


On Thu, 20 Dec 2007 03:41:21 +0000
Duncan Coutts <duncan.coutts at worc.ox.ac.uk> wrote:

> The main advantage of c2hs over hsc2hs is that c2hs generates the
> correct Haskell types of foreign imports by looking at the C types in
> the header file. This guarantees cross language type safety for
> function calls. It also eliminates the need to write foreign imports
> directly which saves a lot of code. hsc2hs provides no help for
> writing function imports.
> 
> The main disadvantage of c2hs compared to hsc2hs is that c2hs's
> support for marshaling structures is less than stellar while hsc2hs
> is pretty good at that.
> 
> In gtk2hs we use both. We use c2hs for all function calls and we use
> hsc2hs to help us write Storable instances for a few structures.

It looks that c2hs does more than hsc2hs and misses less than hsc2hs.

Why not equip c2hs to do the rest and have one complete tool instead of
the two uncomplete ones? (I understand that time-factor could be the
reason.)

I am for the choice, but there are several library-areas (database
binding is one) in Haskell where we could (maybe) apply/strive for
"less is better" slogan ;)

Sincerely,
Gour


More information about the Haskell-Cafe mailing list