On May 12, 2008, at 3:40 PM, Jay Walters wrote:
So does it make sense for me to be playing in the jna packages with
my own custom classes? It seems that i cannot extend Pointer, etc
from outside those packages.
If I have a Pointer object, is there a simple way to load the data
from the Pointer into Java class. As you might by casting a pointer
in ANSI C?
Is the pattern for using JNA that one would extend in the JNA
packages, so for my ACL object I would make an ACL class in there?
Or do people just go untyped?
PointerType allows for typesafe pointers; you can use a PointerType
any place you might a native pointer. Structure.useMemory() allows
for reassigning the underlying memory used by a given structure
instance; Structure.read/write synchronize with native memory.
You shouldn't put anything in the JNA packages.
In your case, you probably want to get the pointer via
PointerByReference, then create a new structure of your ACL type
passing it PointerByReference.getValue() which it'll use internally
with Structure.useMemory(), followed by Structure.read() to intialize
the java fields from the native memory.