Updates to FFI spec: header files

Manuel M T Chakravarty chak at cse.unsw.edu.au
Tue Sep 10 03:49:20 EDT 2002


"Simon Marlow" <simonmar at microsoft.com> wrote,

> > >> - I see the question of Function prototypes as a portability
> > >> problem waiting to happen.  Either Hugs and GHC are right (you
> > >> should use the user-supplied header file or NHC is right (you
> > >> should ignore the header file).  They can't both be right if we
> > >> want portable code so the report should be clear about which one is
> > >> right.
> 
> I think the spec should be clarified along these lines:
> 
>   Header files have no impact on the semantics of a foreign call,
>   and whether an implementation uses the header file or not is
>   implementation-defined.  Some implementations may require a header
>   file which supplies a correct prototype for the function in order
>   to generate correct code.

In fact, this is what I think we did originally intend.  We
definitely said that some implementations (which just
generate assmebler, for example) may ignore the header file,
but we also recognised that some implementations may make
use of them.  

As Fergus said, it is better if the header files are taken
into account, but we didn't want to force that extra
complexity onto implementations.

I don't see any strong arguments for changing our original
intention and there are arguments against changing it.  So,
let's leave things as we originally intended them.  I'll add
SimonM's above clarification to the spec.

Manuel



More information about the FFI mailing list