problems with FFI including h files

Carl R. Witty
10 Jun 2002 15:18:37 -0700

Alastair Reid <> writes:

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

I think some ABI's specify a different calling convention for varargs
functions than non-varargs functions.  (I remember reading this on
some Haskell mailing list some time back, one of the previous times
this same discussion occurred.)

Carl Witty