Skip to main content

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

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


Back to the top