[Haskell-cafe] compilation to C, not via-C
Donn Cave
donn at avvanta.com
Fri Apr 24 13:20:57 EDT 2009
Quoth Alex Queiroz <asandroq at gmail.com>,
> Actually some Scheme compilers have a "c-declare" form that lets
> you create C functions, which can be called from C, Haskell, Java,
> Ruby etc.
That would be like what you get with Haskell FFI "export"?
When I do this with nhc98, I need a nhc98 "main", and I would expect
the same with GHC. Part of the deal would be smuggling in and
initializing the Haskell runtime. Also figuring out storage, if
returning any values from the exported Haskell function (as opposed
to poking them into address parameters.) I can see how this would
not be suitable for a library.
But the same applies to C code generated by "nhc98 -C". It looks
more like a compiled Haskell module expressed as a C program, than
Haskell translated to C, if that makes sense, and it will certainly
have all the same issues as the Haskell module.
Donn
More information about the Haskell-Cafe
mailing list