From: Duncan C. <dun...@wo...> - 2004-04-15 15:03:54
Attachments:
Notebook.chs.patch
WidgetTable.hs.patch
|
I tried rebuilding gtk2hs against gtk+-2.4 and got some type errors in layout/Notebook.(c)hs My guess is that a few functions that previously returned void now return cint. http://developer.gnome.org/doc/API/2.0/gtk/GtkNotebook.html#gtk-notebook-append-page Perhaps you can do that in C without breaking binary compatibility. The simple fix is to explicitly return (), that's what the attached patch does. If we think we should return the cint (it gives the index of the inserted page) that would be easy too, but would be an API change. What's the best thing to do when gtk+ changes the API? Change with it, try to preserve backwards compatibility or have gtk2hs present a different API depending on which version gtk+ is was built against? If nobody cares, I'll commit the patch which preserves the existing API and allows gtk2hs to build against gtk+-2.4 Also, with ghc 6.2, foreignPtrToPtr has been renamed to unsafeForeignPtrToPtr and is exported from module ForeignPtr. Should I just fix it and thus bump the requirement up to ghc 6.2 or should I start adding #if __GLASGOW_HASKELL__ >= 602 in the appropriate places? This requires adding the -cpp flag (which can be done in an OPTIONS pragma). Duncan |
From: Axel S. <A....@ke...> - 2004-04-15 15:54:56
|
On Thu, Apr 15, 2004 at 04:03:55PM +0100, Duncan Coutts wrote: > I tried rebuilding gtk2hs against gtk+-2.4 and got some type errors in > layout/Notebook.(c)hs > > My guess is that a few functions that previously returned void now > return cint. > http://developer.gnome.org/doc/API/2.0/gtk/GtkNotebook.html#gtk-notebook-append-page > > Perhaps you can do that in C without breaking binary compatibility. Yes, you can. Unfortunately that is not possible in Haskell. > > The simple fix is to explicitly return (), that's what the attached > patch does. If we think we should return the cint (it gives the index of > the inserted page) that would be easy too, but would be an API change. I did put such subtle changes between #ifdefs, see for example treeList/ListStore.chs, function listStoreRemove. I don't know if that is sensible, but I guess it gives you the chance of writing portable code (by not making use of the return value) and code that makes use of the new features. > If nobody cares, I'll commit the patch which preserves the existing API > and allows gtk2hs to build against gtk+-2.4 Preferably with the ifdef's, if possible. I will try to make it all compile with ghc 6.2 over the week end since the port freeze for FreeBSD is on the 20th of April. > Also, with ghc 6.2, foreignPtrToPtr has been renamed to > unsafeForeignPtrToPtr and is exported from module ForeignPtr. Should I > just fix it and thus bump the requirement up to ghc 6.2 or should I > start adding #if __GLASGOW_HASKELL__ >= 602 in the appropriate places? There is a module called FFI in which this is fixed. I was kind of lazy and renamed unsafeForeignPtrToPtr to foreignPtrToPtr for GHC 6.2. Moreover the arguments for newForeignPtr swapped with version 6.2. > This requires adding the -cpp flag (which can be done in an OPTIONS > pragma). That is then only required in general/FFI.hs. Thanks for your effort, Axel. |
From: Duncan C. <dun...@wo...> - 2004-04-15 18:02:30
Attachments:
Notebook.chs.patch
WidgetTable.hs.patch
|
On Thu, 2004-04-15 at 16:53, Axel Simon wrote: > I did put such subtle changes between #ifdefs, see for example > treeList/ListStore.chs, function listStoreRemove. I don't know if that is sensible, > but I guess it gives you the chance of writing portable code (by not making use of > the return value) and code that makes use of the new features. > > > If nobody cares, I'll commit the patch which preserves the existing API > > and allows gtk2hs to build against gtk+-2.4 > > Preferably with the ifdef's, if possible. I will try to make it all compile with ghc > 6.2 over the week end since the port freeze for FreeBSD is on the 20th of April. Ok, the attached patch uses ifdef's in the style of treeList/ListStore.chs, if you think that looks ok I'll commit it. > There is a module called FFI in which this is fixed. I was kind of lazy and renamed > unsafeForeignPtrToPtr to foreignPtrToPtr for GHC 6.2. Moreover the arguments for > newForeignPtr swapped with version 6.2. Comitted. I just added an import of FFI (foreignPtrToPtr) Duncan |