References to values and weak references.

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

Simon Marlow wrote:
> > (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
> We have this.  It's called "foreign label", but it's in an obscure part of
> the documentation - you're not the first person to miss it :)
Oh alright, found it, thanks!
> Do you know how to use existing support for weak references in the
> linker/assembler?  I believe GNU as/ld has them, but I can't find any
> reference in the docs.
I've never used weak references, but I would wager that any of the systems
ghc works on supports them.  I suppose there are two problems:
(1) You need to get weak references into the object files.
(2) You need to get the linker to do something sensible with them.
    For example, for SunOS 5.7 "man ld" yields the following option:     
       -z allextract | defaultextract | weakextract
    which adjusts ld for different policies for linking weak references.

More information about the FFI mailing list