Updates to FFI spec

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Aug 12 07:21:57 EDT 2002

On 12-Aug-2002, Simon Marlow <simonmar at microsoft.com> wrote:
> I'd be equally happy (perhaps happier) if the header file spec was
> removed altogether.  In a sense, this would leave the Haskell part of a
> foreign binding even more portable, because it doesn't have to specify
> the names of header files which might change between platforms.

This is a C interface we're talking about, right?

In C, the name of the header file is part of the API.
It doesn't change between different platforms unless
the API changes.

Specifying the header name is essential if Haskell implementations are to
ever apply any type-checking to these foreign interfaces.  If they don't,
then in practice I think Haskell programs using the FFI are likely to be
less portable, and certainly more error-prone, since they will contain
type errors that may cause problems on one platform but not another.

> There
> are already "external" parts of a binding such as the names of link
> libraries, I think I'm arguing that header files also fall into that
> category.

If so, I find this a pretty unconvincing argument.  Header search paths
(i.e. `-I' options), yes, but the part of the name which goes in between
the quotes or angle brackets in a #include line, no.  They are part of
the API.

Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.

More information about the FFI mailing list