8 messages in net.java.dev.jna.usersRe: [jna-users] Question on variable ...
FromSent OnAttachments
Jay WaltersMay 12, 2008 9:42 am 
Timothy WallMay 12, 2008 9:52 am 
Jay WaltersMay 12, 2008 11:05 am 
Jay WaltersMay 12, 2008 11:12 am 
Timothy WallMay 12, 2008 12:05 pm 
Timothy WallMay 12, 2008 12:10 pm 
Jay WaltersMay 12, 2008 12:39 pm 
Timothy WallMay 12, 2008 2:05 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] Question on variable length structures in Win32Actions...
From:Timothy Wall (twal@dev.java.net)
Date:May 12, 2008 2:05:26 pm
List:net.java.dev.jna.users

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.