References to values and weak references.

George Russell ger at Informatik.Uni-Bremen.DE
Wed Nov 8 10:27:02 EST 2000

I have just come up against an application where I would like the user to be 
able (if required) to link in a file containing a set of default options to the
application.  So what I would IDEALLY like is
(1) the ability for FFI to give me access to an external value as well as an external
    function, as in 
       foreign import "default_arguments" defaultArguments :: Addr
(2) the ability for FFI to link in values as weak external references.  (In other words
    the reference doesn't have to be resolved and you can find out if it has been.)
    So assuming (1) has been implemented, I might want something additionally like
       foreign import weak "default_arguments" getDefaultArguments :: IO (Maybe Addr)
Now while I would LIKE these features, they aren't there, and it won't cause me great
distress to work around their absence.  But why not implement them anyway?

More information about the FFI mailing list