
25 Aug
2009
25 Aug
'09
8:45 a.m.
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