FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Regenerate bindings with gsize and gssize fixed?

 
Post new topic   Reply to topic     Forum Index -> gtkD
View previous topic :: View next topic  
Author Message
JNewt



Joined: 05 Jun 2008
Posts: 69

PostPosted: Tue Apr 19, 2011 2:56 pm    Post subject: Regenerate bindings with gsize and gssize fixed? Reply with quote

While attempting to diagnose a bug (ticket: http://dsource.org/projects/gtkd/ticket/101), I discovered that glibtypes.d defines gsize and gssize as uint and int respectively. While this works on 32bit systems, I believe it is incorrect when building for 64bit architectures (see http://developer.gnome.org/glib/2.28/glib-Basic-Types.html#gsize)

The problem is further exacerbated by the wrapper generator's substitution of uint and int for gsize and gssize (see wrap/API_Lookup.txt lines 74-76)--because it's a textual substitution throughout the library, it makes it impossible to correct the problem by simply changing the aliases in src/gtkc/glibtypes.d

Can the devs regenerate the bindings using the correct definitions? I believe gsize should be aliased to size_t and gssize to ptrdiff_t.
Back to top
View user's profile Send private message
Mike Wey



Joined: 07 May 2007
Posts: 428

PostPosted: Tue Apr 19, 2011 3:51 pm    Post subject: Reply with quote

Rewrapped in svn r826, the manualy added function still need to be checked tough.
Back to top
View user's profile Send private message
JNewt



Joined: 05 Jun 2008
Posts: 69

PostPosted: Tue Apr 19, 2011 4:05 pm    Post subject: Reply with quote

Thanks, I've updated and it almost builds. Here's a patch to get it the rest of the way (don't see anyway to attach files here):
Code:
Index: src/gdk/Pixbuf.d
===================================================================
--- src/gdk/Pixbuf.d   (revision 826)
+++ src/gdk/Pixbuf.d   (working copy)
@@ -249,7 +249,7 @@
    public int saveToBufferv(out char[] buffer, string type, string[] optionKeys, string[] optionValues)
    {
       gchar* outbuffer = null;
-      uint bufferSize;
+      size_t bufferSize;
       GError* err = null;
       
       // gboolean gdk_pixbuf_save_to_bufferv (GdkPixbuf *pixbuf,  gchar **buffer,  gsize *buffer_size,  const char *type,  char **option_keys,  char **option_values,  GError **error);
Index: src/glib/IOChannel.d
===================================================================
--- src/glib/IOChannel.d   (revision 826)
+++ src/glib/IOChannel.d   (working copy)
@@ -166,12 +166,12 @@
     * Returns: the status of the operation.
     * Throws: GException on failure.
     */
-   public GIOStatus readLine(out string strReturn, out uint terminatorPos)
+   public GIOStatus readLine(out string strReturn, out size_t terminatorPos)
    {
       // GIOStatus g_io_channel_read_line (GIOChannel *channel,  gchar **str_return,  gsize *length,  gsize *terminator_pos,  GError **error);
       GError* err = null;
       char* str = null;
-      uint len;
+      size_t len;
       
       auto p = g_io_channel_read_line(gIOChannel, &str, &len, &terminatorPos, &err);
       
@@ -207,7 +207,7 @@
       // GIOStatus g_io_channel_read_to_end (GIOChannel *channel,  gchar **str_return,  gsize *length,  GError **error);
       GError* err = null;
       char* str = null;
-      uint len;
+      size_t len;
       
       auto p = g_io_channel_read_to_end(gIOChannel, &str, &len, &err);
       
Index: GNUmakefile
===================================================================
--- GNUmakefile   (revision 826)
+++ GNUmakefile   (working copy)
@@ -38,6 +38,10 @@
     LDFLAGS+=$(LINKERFLAG)-ldl
 endif
 
+ifeq ("$(ARCH)", "x86_64")
+    DCFLAGS+=-m64
+endif
+
 AR=ar
 RANLIB=ranlib


Note that I've also modified the makefile to actually make use of the ARCH variable. I think all the active D compilers support the -m64 flag.
Back to top
View user's profile Send private message
Mike Wey



Joined: 07 May 2007
Posts: 428

PostPosted: Wed Apr 20, 2011 2:12 pm    Post subject: Reply with quote

Added in svn r827
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> gtkD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group