Graphics with XDarwin on Mac OS X

Alastair Reid reid@cs.utah.edu
12 Jun 2002 00:27:17 +0100


> 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.

> I don't have GreenCard installed, so I can't regenerate X.c the
> proper way.  Is there a better way of making a MacOS X compatible
> distribution than requiring the user to run GreenCard?

Just do what we do with the standard HGL distribution: include the .c
and .hs files in the distro and don't set rerun_GC=yes.


-- 
Alastair Reid        reid@cs.utah.edu        http://www.cs.utah.edu/~reid/