ghc4.08.1 - bug in either foreign label or CString (or somewh ere).

Simon Marlow simonmar at microsoft.com
Fri Nov 17 05:17:24 EST 2000


> "foreign label ..." delivers a pointer to the named C object. 
> - I think,
> the question is: What happens when this object is a pointer itself?
> When defining hello.c & hello.h as follows, the example works fine:
> 
> hello.c:
>   #include "hello.h"
>   const char hello[] ="hello, world";
> 
> hello.h:
>   const char hello[];
> 
> (But I still wonder how the former example could work with GHC4.08?)

Yup, that's it.  A "foreign label" is defined as giving the address of
the label itself; if this address points to a C variable which contains
a pointer, you have to do the second indirection explicitly.

As I recall, GHC 4.08 had a bug which meant that the extra indirection
was done accidentally when compiling via C.

Cheers,
	Simon




More information about the Glasgow-haskell-bugs mailing list