problems with FFI including h files
Alastair Reid
reid@cs.utah.edu
05 Jun 2002 16:25:14 +0100
> I thought we established that generating valid C prototypes from the
> Haskell FFI type signature wasn't possible due to the incompleteness
> of the Haskell type (lack of 'const' modifiers for one thing - is
> there anything else?).
Compilers use the same calling sequence whether you tell them about
const or not.
I believe that we can call all C functions correctly knowing only the
calling convention (ccall, stdcall, etc) and the Haskell type. I
certainly hope this is true since Hugs' implementation of wrappers
depends on it.
(Hmmm, some calling conventions do funny things when passing and
returning small structs. I don't know much about this though...)
>> This is roughly how the Hugs FFI header file will look once my
>> current hacking on it is finished.
> Looks good.
As of course it should since I stole vast swathes from GHC's HsFFI.h :-)
--
Alastair