From: John L. <jw...@gm...> - 2012-09-12 06:20:32
|
Hello, I've been working on updating gtk2hs to work with ghc-7.6.1, and I believe I have made all the necessary changes (I don't think anyone else was doing this yet). It was mostly straightforward, however there is a particular class of changes that I'm a bit concerned about. The simplest example is probably from glib/System/Glib/MainLoop.chs. Here's some code after the c2hs pass: type SourceFunc = FunPtr (((Ptr ()) -> (IO CInt))) foreign import ccall "wrapper" mkSourceFunc :: IO CInt -> IO SourceFunc This is accepted by ghc-7.4, but in 7.6 it's rejected because of the extra Ptr () parameter in SourceFunc. It's fixed by adding the extra argument in the mkSourceFunc wrapper, with the full change being: diff -r gtk2hs/glib/System/Glib/MainLoop.chs sources/glib-0.12.3.2/System/Glib/MainLoop.chs 74c74 < foreign import ccall "wrapper" mkSourceFunc :: IO {#type gint#} -> IO SourceFunc --- > foreign import ccall "wrapper" mkSourceFunc :: (Ptr () -> IO {#type gint#}) -> IO SourceFunc 82c82 < funPtr <- mkSourceFunc fun --- > funPtr <- mkSourceFunc (const fun) There are about a dozen files throughout gtk2hs which need adjustments along these lines. Does this seem like the best way to handle the issue? I'm concerned that the wrapper functions were originally typed this way for compatibility with separate versions of gtk+, and this will cause breakage for those versions. If this looks like the right approach, I'm happy to bundle up patches and submit them. John L. |