

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
12 messages in net.java.dev.jna.usersRe: [jna-users] Structure| From | Sent On | Attachments |
|---|---|---|
| Paul Loy | Jan 10, 2008 8:29 am | .java |
| Paul Loy | Jan 10, 2008 9:31 am | .java |
| Paul Loy | Jan 10, 2008 9:47 am | .java |
| Timothy Wall | Jan 14, 2008 5:08 am | |
| Timothy Wall | Jan 14, 2008 5:23 am | |
| Paul Loy | Jan 14, 2008 5:46 am | |
| Paul Loy | Jan 14, 2008 8:56 am | |
| Paul Loy | Jan 14, 2008 9:21 am | |
| Timothy Wall | Jan 14, 2008 9:57 am | |
| Timothy Wall | Jan 14, 2008 11:32 am | |
| Paul Loy | Jan 15, 2008 2:05 am | |
| Timothy Wall | Jan 15, 2008 5:41 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: [jna-users] Structure | Actions... |
|---|---|---|
| From: | Timothy Wall (twal...@dev.java.net) | |
| Date: | Jan 14, 2008 9:57:29 am | |
| List: | net.java.dev.jna.users | |
Field reads and writes for struct arrays were not being handled properly; I've fixed this in SVN and added tests for it.
On Jan 14, 2008, at 8:46 AM, Paul Loy wrote:
I'll check out the latest from SVN and give it another try.
To try to put my problem into context:
I'm actually wanting to call down into the Quicktime API as QTJ does not have QT7 API functions in it. I'm actually wanting to mute/unmute individual channels. This is done by sending a property to the track which contains the channel(s) to mute. At compile-time, the number of channels in a given track is unknown. So the I need a variable-length array of ChannelDescription structs inside the TrackProperty struct.
i.e.
public class TrackProperty extends Structure { public int numofchannels; public ChannelDescription[] descriptions; }
public class ChannelDescription extends Structure { public float volume; public float[3] position; }
(obviously these are simple mock-ups and not the actual structures, but give you a better context)
So, assuming I unhollow/initialise these fully, the .size() method should give me a size as this is actually an argument into the Native function I am calling.
Initially it did not. I will try the latest SVN and let you know soon. If it does fail, I'll do another more realistic test.
Thank you for your help!
Paul.
On Jan 14, 2008 1:23 PM, Timothy Wall <twal...@dev.java.net> wrote:
On Jan 10, 2008, at 11:30 AM, Paul Loy wrote:
Hi All,
I am trying to create a Variable length Structure, where the variability is the length of an array of Structures inside the Variable length Structure. (please see attached unit tests)
I get a NPE in Structure.getNativeSize(Class, Object) due to the fact that in Structure.getNativeAlignment(Class, Object, boolean), when it finds an Array it sends null as value back into itself:
... else if (type.isArray()) { alignment = getNativeAlignment(type.getComponentType(), null, firstElement); } ...
I guess this is a bug?
Your description doesn't match up against your test. An inner array of fixed-size structures must be initialized before Structure.allocateMemory/calculateSize is called; are you using the latest SVN sources?
Note that the inner, fixed-size structure must have a public no-arg constructor, and that Structure.size() must return a valid value after the object is created.
When I run your test, the explicit "fail" is invoked on the last two test methods, so perhaps we're using different codebases.
(BTW, I'll be posting an "official" 3.0 release sometime this week)
T.
--
--------------------------------------------- Paul Loy pa...@keteracel.com http://www.keteracel.com/paul








.java