2 messages in net.java.dev.jna.usersRe: [jna-users] Pointer to array of s...
FromSent OnAttachments
Anderson ShigaDec 12, 2008 1:32 pm 
Timothy WallDec 12, 2008 4:14 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] Pointer to array of structs (**str)Actions...
From:Timothy Wall (twal@dev.java.net)
Date:Dec 12, 2008 4:14:53 pm
List:net.java.dev.jna.users

PointerByReference is appropriate. Create an instance of your structure in Java and use Structure.useMemory to use the returned pointer. Then use Structure.toArray() to expand from the single structure instance.

On Dec 12, 2008, at 4:33 PM, Anderson Shiga wrote:

Hi, Can somebody give me a code sample of getting a pointer to an array of structs from C as a function parameter?

example of structure:

typedef struct abc { int a; int b; char c; } str;

C function to access which returns the pointer:

void getIt(str **x)

I tried to use PointerByReference on the Java side, but I don't know how to convert the PointerByReference (and if that's the correct class to be used!) object returned into a Java Structure class. I couldn't find any method that would allow me to convert a Pointer or a Pointer[] into an Object and then into the desired Java Structure.

Thanks!