type checking ffi's

Matthew Fluet mfluet@intertrust.com
Fri, 22 Jun 2001 09:59:42 -0700 (PDT)


> Are you talking about the fact that the same C function (printf) is used twice?
> What would you `check' the interface with?
> Note, gcc does check printf, but it is really a gross (but useful) hack.
> I never use printf in ML, but I agree that it shows that some convenient
> printing thing is needed.

Steve had mentioned the possibility of trying to dynamically check that
the type declarations for _ffi's matched with their corresponding C
definitions.  For the C-codegen, we needed to include the .h files in the
generated C function for gcc to check.  In theory, we don't need this in
the native backend -- we're just relying on the linker to resolve the
symbols.  But, we still go out to gcc to get compile-time constants
(nullary _prim's).  At this time, we would like to take each _ffi and
create an expression that type checks in gcc iff the _ffi has a type
compatible with the real C type.