FFI proposal: allow some control over the scope of C header
Manuel M T Chakravarty
chak at cse.unsw.edu.au
Sat Apr 29 19:19:08 EDT 2006
> It is my understanding that the FFI foreign imports declare an ABI and
> not an API, meaning the exact way to make the foreign call should be
> completely deterministic based on just what is in the haskell file
> proper. Otherwise, obviously, direct to assembly implementations would
> be impossible.
> In this sense, include files are always potentially optional, however,
> due to the oddness of the C langauge, one cannot express certain calls
> without proper prototypes, current haskell implementations take the
> straightforward path of relying on the prototypes that are contained in
> the system headers, which also incidentally provides some safety net
> against improperly specified FFI calls. However, it would also be
> reasonable for an implementation to just generate its own prototypes, or
> use inline assembly or any other mechanism to implement the FFI ABI
> calls properly.
Exactly! The FFI Addendum specifically leaves the compiler complete
freedom as to which method to choose. I regard this property of the
specification as important and we should keep it for Haskell'.
More information about the Haskell-prime