> 2) Restrict ffi to invoking functions not macros.
> 
>    In this case, GHC generates function prototypes itself 
> based on the 
>    Haskell type and ignores the header files.
> 
>    If you want to detect mismatches between function 
> prototypes in the C
>    header file and the GHC-generated prototypes, you could 
> generate a C
>    file like this:
> 
>      #include <ffi_specified_headers.h>
>      #include <ghc_generated_prototypes.h>
> 
>      GHC_type_for_f *f_pointer = &f;
> 
>    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
_______________________________________________
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to