Modified proposal for default decls
reid at cs.utah.edu
Mon Feb 26 13:17:07 EST 2001
> Many C interfaces contain a significant number of macros. And C is
> one of the most widely used languages that we want to interface with.
> So it seems to me that any FFI which aims to provide *good* support for
> C ought to provide a way of accessing C macros.
[Sorry for replying twice to the same paragraph...]
I just remembered that my project (Knit - a C component language) has severe
problems with use of macros in header files.
We are planning to solve these problems by writing a little tool that generates
C function wrappers for macros. The idea is that you'd list the functions you
want generated, their C type and the name of the corresponding macro and the
tool would generate functions to call them and a header file to #include in
place of the original file. In a way, this is like an ffi from C to CPP :-)
Obviously this won't handle every possible macro but we hope it will handle
enough of the common cases to be useful. The most obvious omission will be
macros (like stderr) which look like variables - gcc provides a few tricks
which might handle some of these problems.
My project is planning to write this tool but would be more than happy if
someone else did it first :-)
More information about the FFI