FFI Definition
Alastair Reid
reid at cs.utah.edu
Sun May 6 13:29:18 EDT 2001
> foreign export dynamic is a shortcut for importing an automatically
> generated nontrivial C function, with argument type not conforming to
> regular imports, which could not be written by hand.
I don't get it. How do you use a function with a type like:
(Int -> IO Int) -> Addr
to import a C function? The closest I can get is to use foreign label
to get an Addr (or FunPtr if preferred) but now I'm stuck. What's up?
> So it's actually an *import*! It could be spelled as import with a
> magical name - again all parameters are in the type.
But it is also used for exporting so the name doesn't seem that
inappropriate.
Unless you're arguing that, since it brings a name into scope it can
be thought of as a kind of import??? (But I don't think you are saying
that.)
--
Alastair Reid reid at cs.utah.edu http://www.cs.utah.edu/~reid/
More information about the FFI
mailing list