Extension to the FFI to allow macro expansions to be avoided

Alastair Reid alastair at reid-consulting-uk.ltd.uk
Tue Apr 13 06:53:22 EDT 2004


> And Hugs too.  The issue isn't extending the FFI but implementing it
> more accurately and consistently.  As you point out, systems compiling
> via C have been extending the FFI to a function+macro interface, which is
> incompatible with systems compiling to native code.  Having been bitten by
> the same thing in the opposite direction (macros that work with ffihugs
> or ghc -fvia-C don't work with ghc -fasm), I'd favour turning off the
> macro interface, preferably with #undef, at least by default.

Maybe the code generated by Hugs should be something like:

#ifdef MACROS_ARE_COOL
#undef malloc
#endif

?

(I'm not likely to implement this anytime soon but if someone has the energy 
to do so, go right ahead.)

From what I know of NHC, it probably has the same extension and would benefit 
from the same cleanup.

--
Alastair


More information about the FFI mailing list