scope of header files

John Meacham john at repetae.net
Wed Mar 5 21:57:14 EST 2008


On Thu, Mar 06, 2008 at 02:39:35AM +0000, Ian Lynagh wrote:
> I can't remember if it's been discussed before, but I think it might be
> a good idea for the FFI to be able to create these C stubs itself, if
> you give a certain keyword - or perhaps even by default as it's the
> safe thing to do, at the expense of performance.

The FFI defines an ABI spec, not an API one. As in, a C compiler is
never inherently involved, (hence the ability to have Haskell compilers
with a pure assembly back end). Tools like hsc2hs are there to bridge the gap
to a particular language when needed. 

Some libraries guarantee an ABI, others just an API. Hopefully it is
documented. :). In general, in order to support dynamic linking, the ABI
must remain stable so tools like 'hsc2hs' often aren't needed when
interfacing to C code.

In any case, it is not the FFI's job, though of course, specific Haskell
compilers are free to provide extensions. But I'd rather see GHC get
further away from C idiosyncrasies instead of closer.

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the Glasgow-haskell-users mailing list