4 messages in net.java.dev.jna.usersRe: [jna-users] Returning Object type
FromSent OnAttachments
Duncan McGregorNov 15, 2007 11:14 am 
Timothy WallNov 15, 2007 11:40 am 
Timothy WallNov 15, 2007 11:49 am 
Duncan McGregorNov 16, 2007 1:39 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] Returning Object typeActions...
From:Timothy Wall (twal@dev.java.net)
Date:Nov 15, 2007 11:49:17 am
List:net.java.dev.jna.users

On Nov 15, 2007, at 2:15 PM, Duncan McGregor wrote:

So I guess the gist of what I'm asking is, is there any way to marshal an arbitrary bit of memory, which may be a pointer, or may be 32 bits of data?

One other alternative is to simply always return "int" instead of "Pointer"; if your pointers are opaque (i.e. *you* don't ever need to look at the memory), then you can just treat the "int"s as unique identifiers and pass those around rather than Pointers.

BTW, you can use Memory to "cast" from one type to another, e.g.

Memory m = new Memory(4); int ivalue = 0x42; m.setInt(0, ivalue); Pointer p = m.getPointer(0); // 0x42

Only meant as a last-ditch effort if no other alternative works cleanly.