Importing a reference to a non-function entity.

Simon Marlow
Wed, 20 Feb 2002 13:28:15 -0000

> What is the politically correct way using the FFI and ghc5.03=20
> (which I have just managed to compile from
> CVS) to import an externally defined object (not a function)?=20
>  I have a source file containing the line
> foreign label "default_options" defaultOptions :: CString.CString
> for which ghc5.03 complains about "Warning: foreign=20
> declaration uses deprecated non-standard syntax",
> but which works anyway.  However in my attempt to be a good=20
> little ghc user, I try instead
> foreign import "default_options" defaultOptions :: CString.CString
> (after deciphering with difficulty the Postscript version of=20
> the FFI document on this screen) but
> still get the deprecated warning.  Then I try
> foreign import ccall "default_options" defaultOptions ::=20
> CString.CString

I believe you meant to say=20

  foreign import ccall "&default_options"=20
     defaultOptions :: CString.Cstring

:-)  (see the latest FFI addendum at =