Graphics with XDarwin on Mac OS X

Johan Nordlander nordland@cs.chalmers.se
Wed, 12 Jun 2002 11:07:22 +0200


On Wednesday, June 12, 2002, at 01:27 , Alastair Reid wrote:

>
>> Reading file "X.hs": ERROR "X.hs":3853 - Unknown primitive 
>> reference "prim_X_fontRightToLeft"
>
>> However, running
>
>>    nm X.so | grep fontRightToLeft
>
>> gives
>
>>    0001408c t _prim_X_fontRightToLeft
>
>> That is, we seem to have run into the leading underscore problem you
>> mentioned.
>
> There must be something else going on here because...
>
> Because of issues like the leading underscore, Hugs only uses dlopen
> on the function initModule at the end of GreenCard generated files.
> The function initModule returns a lookup table that looks like this:
>
>   static struct primitive primTable[] = {
>       {"prim_X", 3, prim_X},
>       {"prim_Y", 3, prim_Y},
>   };
>
> So the error message is not reporting problems finding a C symbol
> "prim_X_fontRightToLeft" but problems finding a Hugs symbol table
> entry "prim_X_fontRightToLeft".  Looking at X.hs,
> prim_X_fontRightToLeft is the last primitive in the file so it is the
> first one that Hugs tries to resolve.
>
> This probably means that the entire symbol table is missing.

Sounds convincing.  The odd thing is that Xlib_StdDIS seems to 
load ok, though.  And small ffi examples also work as they 
should under MacOS X.

I'll take some time to debug this to find out what happens.

-- Johan