RE: [Java-gnome-developer] handlers as ints?
Brought to you by:
afcowie
From: R. A. R. D. <riv...@ya...> - 2003-11-17 17:15:04
|
--- Jeffrey Morgan <Jef...@Br...> wrote: > > Hello > > > > Checking the docs I have found that handlers are treated as java > ints. > > As we know ints are fixed 32 bits in Java, I wonder what will > > happen in > > 64bits OSes? As I see it, two solutions are posible: 1. Have a > handler > > table to make the conversion, 2. Change everything to long and > > recompile. > > None of this is a good solution. > > I think using a java.awt Peer like solution works better. Hiding > the > > handler in an interface that can be implemented in every platform > is a > > way to work around this problem without the need to change the > library > > in every platform. > > Something like: > > > > public interface Handler {} > > > > public class GObject { > > public GObject(Handler handler) { > > ... > > } > > ... > > } > > > > In native code, every platform have to implement a pair of > functions > > like the following: > > > > int javaToNative(JObject * handler); // receives a Handler instance > > JObject * nativeToJava(int handler); // returns a Handler instance > > > > probably inline functions that should be used whenever is necesary > to > > access a handler. > > > > Then you can have a OS32bitHandler with a java int field inside, > and a > > OS64bitHandler with a java long field inside, and the code in > > javaToNative and nativeToJava will conditionally use one of those > > implementations depending on the arch. > > > > What do you think? > > It seems like a reasonable solution but will we not > have to change all code that passes the int handle > to use jobject instead? > > -Jeff > Yep, the code have to be changed. :-( I have seen also a function to obtain a gtk object from the java equivalent, I hope that updating this function makes most of the work. If this is not the case or I misunderstand the code, then I suppose every component native code need to be updated :-(. I think that's the better aproach. I volunteer to help on it and send the code changed to anyone available to check my work, but first I prefer to check if the developers accept the change. rivas. __________________________________ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree |