11 messages in net.java.dev.jna.usersRe: [jna-users] Structure Order
FromSent OnAttachments
Nicolas VienneJan 10, 2008 2:15 am 
Albert StrasheimJan 10, 2008 2:32 am 
Nicolas VienneJan 10, 2008 2:56 am 
Albert StrasheimJan 10, 2008 3:02 am 
Albert StrasheimJan 10, 2008 3:08 am 
Timothy WallJan 12, 2008 10:49 am 
Nicolas VienneJan 17, 2008 3:45 am 
Albert StrasheimJan 17, 2008 3:48 am 
Timothy WallJan 17, 2008 5:15 am 
Nicolas VienneJan 17, 2008 5:53 am 
Nicolas VienneJan 17, 2008 5:56 am 
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] Structure OrderActions...
From:Albert Strasheim (full@gmail.com)
Date:Jan 10, 2008 2:32:36 am
List:net.java.dev.jna.users

Hello,

On Jan 10, 2008 12:15 PM, Nicolas Vienne <ikar@tagazok.net> wrote:

Hello everybody.

I have a little question about passing Structure between Java and Native : I noticed that the fields must be declared in the same order in both side.

For example:

<snip>

Is there a way - other than avoiding structs - not to rely upon the field order ? I mean that I cannot know the order of both sides and thus it prevents me - for now - from using JNA.

Any ideas ?

If you have control over the C library you are accessing with JNA, you could add getter and setter functions for the struct in C. You could then treat the struct as an opaque object.

For example, you'd have:

void TestStruct_setA(TestStruct* ts, int a); int TestStruct_getA(const TestStruct* ts);

etc.

Cheers,

Albert