Timothy Wall wrote:
On Apr 20, 2008, at 4:43 PM, Peter Nabbefeld wrote:
I've now tried 3.0 (because there's a src.zip for it, needed for
debug), and now I've got other problems. The exception I've got before
(from 3.02) might be a bug.
Current problem is "Exception in thread "main"
java.lang.IllegalStateException: Array fields must be initialized"
The only array in a Structure not yet initialized is declared as
"public StructUsbDevice.ByReference[] children;"
The original c code is "struct usb_device **children;"
It will be hard to initialize this array ... What do I have to do?
Arrays within a Java Structure are inlined, which is not what you want.
Use a Pointer and use the getXXX methods to extract the information you
need.
public Pointer children;
...
usb_device first = new usb_device() { {
useMemory(s.children.getPointer(0)); }};
usb_device[] kids = (usb_device[])first.toArray(length);
Thank You for the guidance - at least, my test app now starts :-)
Kind regards
Peter