[Gtkhs] gtk+hs and ghc-6.0

Sven Panne Sven.Panne@informatik.uni-muenchen.de
Fri, 04 Jul 2003 17:07:34 +0200


Ch. A. Herrmann wrote:
 > I was trying to build c2hs and gtk+hs using ghc-6.0, but in
 > "GdkGC.chs" the return type of "(gcUnref addr)" in function "mkGC"
 > was wrong. [...]

This is caused by some recent changes to the ForeignPtr module and can
easily be fixed:

----------------------------------------------------------------------
--- gtk+hs/gdk/GdkGC.chs.orig	2002-01-15 09:04:27.000000000 +0100
+++ gtk+hs/gdk/GdkGC.chs	2003-07-04 16:46:10.000000000 +0200
@@ -129,10 +129,11 @@
  {#import GdkTypes#}  (Rectangle, RectanglePtr)
  import Char	     (chr)
  import IOExts	     (unsafePerformIO, IORef, newIORef, readIORef)
+import qualified Foreign.Concurrent (newForeignPtr)
  -- evil hack for C2HSDeprecated
  type ForeignObj = ForeignPtr ()
-newForeignObj = newForeignPtr
-foreignObjToAddr = foreignPtrToPtr
+newForeignObj = Foreign.Concurrent.newForeignPtr
+foreignObjToAddr = unsafeForeignPtrToPtr


  {#context lib="libgdk" prefix="gdk"#}
----------------------------------------------------------------------

 > Unfortunately, when using to so-compiled gtk+hs, linking my
 > application program did not succeed, e.g.: [...]

Somehow a dependency for the haskell98 package is missing. Workaround:

    make HC="ghc -package haskell98" all

Probably Manuel can fix these buglets in a nicer way...

Cheers,
    S.