Graphics with XDarwin on Mac OS X

Alastair Reid reid@cs.utah.edu
10 Jun 2002 17:58:30 +0100


> I made a quick attempt at installing the graphics library with MacOS X
> in preparation for the Dec-2001 Hugs release, but I wasn't able to get
> past some DLL related problems.  This is were I stopped:
> 
>    ERROR "lib/x11/Xlib_StdDIS.hs" - Error while importing DLL
>    "/Users/nordland/src/graphics-2.0.4/lib/x11/Xlib_StdDIS.so":
>    Not an recognisable object file
> 
> BTW, getting this far requires replacing "-shared" with "-dynamic",
> and "ld" with "libtools" in the Makefile, as well as adding "-lSystem"
> to the definition of LDFLAGS.

One of two things is (I think) going on:

1) The generated .so file is invalid.

   My memory of libtools is that it acts in quite a different way from
   ld -r and friends.  It could be that the result isn't quite 
   compatible with dlopen and friends.  Or it could be that the way you
   invoke libtools should be very different from ld.

2) The .so filename is invalid.

   This is entirely possible.  IIRC, the object files generated by
   GreenCard are technically object files not shared object files
   so their name should end in .o not .so.  (The reason for this
   confusion is that the fact that you use the -shared flag when building
   these files fooled me into thinking I was building a shared object
   file.  Someone later told me I was wrong.)

   Or, maybe Mac OS X uses a different file suffix for object files
   (e.g., .dll) or doesn't use a file suffix at all?
   If so, it's possible that libtool might do the right thing if
   invoked right but that the current Makefile overrides this correct
   behaviour?

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