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

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Sat Dec 29 12:59:19 EST 2007

On Fri, 2007-12-21 at 10:25 +0100, Gour wrote:
> On Thu, 20 Dec 2007 03:41:21 +0000
> Duncan Coutts <duncan.coutts at worc.ox.ac.uk> wrote:

> > 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.)

The reason hsc2hs does the structure bits well is because it asks the C
compiler about the sizes and offsets of field members. This means it is
always accurate. For c2hs to do the same it has to calculate the sizes,
offsets and alignments of types itself and it requires a lot of work and
testing to make sure this is always 100% accurate.


More information about the Haskell-Cafe mailing list