Extension to the FFI to allow macro expansions to be avoided
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Fri Apr 16 06:32:40 EDT 2004
W liście z czw, 15-04-2004, godz. 18:14 -0700, Fergus Henderson napisał:
> When using the "--target asm" option, which tells the Mercury compiler to
> compile directly to assembler, the Mercury compiler will generate some
> C glue code to handle the FFI interfacing pragmas.
Which - in case it's a plain function - is an unnecessary extra function
Perhaps we should differentiate by a calling convention between linking
to a function directly and generating a source-level C call?
The calling conventions we know would correspond to linking to them
directly. They would perform the necessary magic to turn off macros when
compiling via C, and they would not need a C compiler when compiling via
assembler. There is no need for specifying a C header in this case.
Another calling convention would generate a function wrapper with proper
argument types. It would need "foreign type" declarations and included
headers. The wrapped calling convention in this case is of course
irrelevant, so it's a calling convention rather than a separate flag.
__("< Marcin Kowalczyk
\__/ qrczak at knm.org.pl
More information about the FFI