[Haskell] [Haskell-cafe] ANNOUNCE: system-filepath 0.4.5 and system-fileio 0.3.4

Ian Lynagh igloo at earth.li
Wed Feb 8 19:56:12 CET 2012


On Tue, Feb 07, 2012 at 06:26:48PM -0800, John Meacham wrote:
> 
> Hi, from my reading, it looks like 'capi' means from a logical perspective,
> 
> "Don't assume the object is addressible, but rather that the standard c syntax
> for calling this routine will expand into correct code when compiled with the
> stated headers"
> 
> So, it may be implemented by say creating a stub .c file that includes the
>  headers and creates a wrapper around each one or when compiling via C,
> actually including the given headers and the function calls in the code.

That sounds right. It basically means you don't have to write the C
stubs yourself, which is nice because (a) doing so is a pain, and (b)
when the foreign import is inside 2 or 3 CPP conditionals it's even more
of a pain to replicate them correctly in the C stub.

Unfortunately, there are cases where C doesn't get all the type
information it needs, e.g.:
    http://hackage.haskell.org/trac/ghc/ticket/2979#comment:14
but I'm not sure what the best fix is.

> I ask because jhc needs such a feature (very hacky method used now,
> the rts knows some problematic functions and includes hacky wrappers
> and #defines.) and I'll make it behave just like the ghc one when possible.

Great!


Thanks
Ian




More information about the Haskell mailing list