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?

Quoting Tom Tromey <tromey@xxxxxxxxxx>:

> >>>>> "Seth" == Seth Nickell <snickell@xxxxxxxxxxxx> writes:
> 
> Seth> This seems like not only a maintenance nightmare in the long
> run
> Seth> (I assume GTK will eventually break GTK compat, and the errors
> Seth> generated by hardcoding the sizes could be very difficult to
> Seth> find), but worse, doesn't seem portable in the least.
> 
> This is definitely one of the problems with porting to a 64-bit
> platform.
> 
> One idea I had was to change the field initialization from:
> 
>     public static final int sizeof = 12;  // e.g., from GdkColor
> 
> to:
> 
>     public static final int sizeof = OS.sizeof ("GdkColor");
> 
> Then the OS native code could simply return the correct value.
> 
> Of course there is also the preprocessing idea as floated in the
> earlier 64-bit porting thread.

I didn't think sizeof took a string? I don't know of a wayy in JNI to
pass the actual type to a native function (not saying there's not one,
only that I couldn't find it ;-), so unless JNI includes some sort of
mechanism for getting "sizeof", native calls to every type you want to
get the size of are necessary.

-Seth


Back to the top