problems with FFI including h files

Simon Marlow simonmar@microsoft.com
Wed, 5 Jun 2002 12:06:42 +0100


> 2) Restrict ffi to invoking functions not macros.
>=20
>    In this case, GHC generates function prototypes itself=20
> based on the=20
>    Haskell type and ignores the header files.
>=20
>    If you want to detect mismatches between function=20
> prototypes in the C
>    header file and the GHC-generated prototypes, you could=20
> generate a C
>    file like this:
>=20
>      #include <ffi_specified_headers.h>
>      #include <ghc_generated_prototypes.h>
>=20
>      GHC_type_for_f *f_pointer =3D &f;
>=20
>    and you'll get told of many mismatches.

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

> This is roughly how the Hugs FFI header file will look once my current
> hacking on it is finished.  The current header file contains little
> more than the final struct and a few typedefs.

Looks good.

Simon