|
From: | Per Bothner |
Subject: | Re: Classpath build process and VM-specific issues |
Date: | Wed, 07 Apr 2004 07:19:43 -0700 |
User-agent: | Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.6) Gecko/20040113 |
Jeroen Frijters wrote:
That's why I'm very much in favor of using RawData. ... public abstract class RawData {} public final class RawData32 extends RawData { private int pointer; } public final class RawData64 extends RawData { private long pointer; } All the Java code would ever see are RawData references, but the JNI layer knows that all RawData references are actually 32 or 64 bit (or whatever that platform requires).
But this is a completely different model than the CNI RawData, since you're adding an extra layer of indirection. In CNI, a RawData is not an object that *contains* a pointer; the pointer is the RawData reference itself. I.e. inline void* RawData_to_pointer (RawData *rd) { return (void*) (rd); } *not* inline void* RawData_to_pointer (RawData *rd) { return (void*) (rd->pointer); } Adding the extra indirection seems like a bad idea to me. I'd rather use jlong. But I don't see any real reason not to use RawData. I can see on a few JVMs it may cause problems, but they can easily sed the source to convert RawData to long. Just think of RawData has a macro. -- --Per Bothner address@hidden http://per.bothner.com/
[Prev in Thread] | Current Thread | [Next in Thread] |