Binding to inline functions

Maurí­cio CA mauricio.antunes at gmail.com
Tue Aug 25 08:45:28 EDT 2009


>>> I understand we can't use 'foreign import ccall'
>>> to wrap inline C functions. Do you think it could
>>> be possible to have an option in cabal to generate
>>> such functions in an object file when #included in
>>> a C file, in a compiler independent, portable way?

> I think it would be easy to do in GHC.  We already have the machinery to 
> generate the _stub.c files and compile them.
> 
> The main question is what the syntax should look like.  I was toying with
> 
> foreign import capi "foo" foo :: ...

Under that syntax, how would GHC know where to find
declaration/definition for a function? Since it's not,
by hypothesis, on an object or library file, a C file
will have to be compiled to get both the declaration
and the definition.

Thanks,
Maurício



More information about the Libraries mailing list