25 messages in net.java.dev.jna.usersRe: [jna-users] Getting pointer from ...
FromSent OnAttachments
Stas OskinMar 18, 2009 4:17 am 
Timothy WallMar 18, 2009 5:46 am 
Stas OskinMar 18, 2009 6:01 am 
Stas OskinMar 18, 2009 7:27 am 
Stas OskinMar 21, 2009 1:10 pm 
Timothy WallMar 30, 2009 6:12 am 
Stas OskinMay 26, 2009 4:49 am 
Timothy WallMay 26, 2009 5:15 am 
Stas OskinMay 26, 2009 5:19 am 
Timothy WallMay 26, 2009 6:05 am 
Stas OskinMay 27, 2009 5:20 am 
Timothy WallMay 27, 2009 6:35 am 
Stas OskinMay 27, 2009 9:32 am 
Timothy WallMay 27, 2009 11:13 am 
Stas OskinMay 28, 2009 8:33 am 
Stas OskinMay 28, 2009 8:34 am 
Nikolas LotzMay 28, 2009 8:59 am 
Timothy WallMay 28, 2009 9:03 am 
Timothy WallMay 28, 2009 9:04 am 
Stas OskinMay 29, 2009 8:17 am 
Timothy WallMay 29, 2009 2:38 pm 
Stas OskinMay 30, 2009 5:54 am 
Stas OskinMay 30, 2009 7:21 am 
Timothy WallMay 30, 2009 10:32 am 
Stas OskinMay 30, 2009 5:31 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] Getting pointer from pointerActions...
From:Stas Oskin (stas@gmail.com)
Date:Mar 18, 2009 6:01:38 am
List:net.java.dev.jna.users

Thanks!

Will try this.

2009/3/18 Timothy Wall <twal@dev.java.net>

Use Pointer.share(offset), which is effectively void* p = (char*)p0 + offset

On Mar 18, 2009, at 7:18 AM, Stas Oskin wrote:

Hi.

I have a pointer towards native memory, and need to get a pointer to part of it. Meaning I have * pointer, and want to access * (pointer + 10). When I tried using Pointer.getPointer(), but it not returns the requested data but some junk values.

I also tried to get a ByteBuffer from the pointer, and then write it to pointer using targetPointer.write(bb.array()), but then I got "unsupported operation exception".

The only way that seems to work is getting ByteArray then writing it to Pointer via write(), but this means 2 copy operations (1 for ByteArray and 1 for write() ) where none should be required.

Can anyone advice for a better way to access the memory without all these copy operations?

P.S.: I read somewhere that by default JNI works in BigEndian, and not in LittleEndian as Intel machines require. Could it be realted to garbage I get when trying to get a pointer via getPointer()?