Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] struct sizes hardcoded?

When GTK breaks binary compatibility, then every C app in the world is
screwed
along with SWT.  These numbers are generated by a small C program.



                                                                                                                                           
                      snickell@xxxxxxxxxxxx                                                                                                
                      Sent by:                        To:      platform-swt-dev@xxxxxxxxxxx                                                
                      platform-swt-dev-admin@         cc:                                                                                  
                      eclipse.org                     Subject: [platform-swt-dev] struct sizes hardcoded?                                  
                                                                                                                                           
                                                                                                                                           
                      09/18/02 07:33 PM                                                                                                    
                      Please respond to                                                                                                    
                      platform-swt-dev                                                                                                     
                                                                                                                                           
                                                                                                                                           



Hi,

I was switching to not allocating GtkIters using a "custom" native
function. However.... I don't see a way you can pass custom types into
"sizeof" from Java. I noticed that many of the struct types have
hardcoded sizes in their "java equivalents" (not wrappers really, I
guess, but the classes like GdkEvent, etc).

This seems like not only a maintenance nightmare in the long run (I
assume GTK will eventually break GTK compat, and the errors generated by
hardcoding the sizes could be very difficult to find), but worse,
doesn't seem portable in the least. Many of these structures contain
types which will be different sizes on, for example, 64-bit integer
platforms. Am I totally missing something or is this as broken as it seems?

Unless somebody can figure out a way to express sizeof in Java code, it
seems like the only way to really deal with this is to have custom
native functions for the sizeof each struct of interest, e.g.
sizeofGdkEvent, sizeofGtkIter, that sort of thing (but of course, that's
unquestionably evil, better to sacrifice maintenance and correctness).

-Seth
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev






Back to the top