FFI progress

Alastair Reid reid at cs.utah.edu
Wed Mar 28 14:10:46 EST 2001


I like this nice, simple design.

I'm a little uncertain about the multiple header-file aspect but have no strong
 feelings either way.

If most libraries could be ffi'd without the need for additional C files, the
 multiple header file notation would be an obvious win.

As it is, many libraries I've dealt with need one or more .c files containing
 some support code and, in that case, it's not too big a deal to add another file.

Some questions though.  Suppose I have two ffi decls with differing orders of files:

>   foreign import "<foo.h>,<bar.h>:f" f :: <type>
>   foreign import "<bar.h>,<foo.h>:f" g :: <type>
Should I report an error?

Or, suppose I have:

>   foreign import "<foo.h>:f" f :: <type>
>   foreign import "<bar.h>:g" g :: <type>
>   foreign import "<foo.h>:h" h :: <type>

can I assume that foo.h will only be included once?
can I assume that foo.h is included before bar.h?

(When answering, remember that an optimising compiler might combine code from
 multiple modules (possibly with multiple maintainers) into a single C source
 file due to cross-module inlining.)

--
Alastair





More information about the FFI mailing list