11 messages in net.java.dev.jna.usersRe: 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: Structure OrderActions...
From:Nicolas Vienne (ikar@tagazok.net)
Date:Jan 17, 2008 3:45:40 am
List:net.java.dev.jna.users

Timothy Wall <twalljava@...> writes:

Since C determines the memory layout based on the order of declaration, this is not exactly an onerous burden.

I'm aware of this fact and of course my request is not a lament on that. I just encoutered the problem and I wanted to know if there was a solution.

I think you're leaving out some critical details about what you're trying to accomplish. Do you have some other high-level language which is auto-generating the struct layout? You will *always* need to tell the Java side how to map its struct fields into memory, whether it's by convention or explicit configuration.

Both side (Java and C++) a generated from a model and I have no control on the order in which fields are created.

Around the same subject, I've slightly modified the JNA source to gain a better control on the field order by using Java annotations. I mean that in a class extending Structure, I can choose which fields will be taken into account for the mapping and in which order. I just noticed that a new version was available, but anyway if someone is interested I may post the changes.

Thank you anyway for your reply

Nicolas