On Apr 20, 2008, at 6:33 AM, Peter Nabbefeld wrote:
Hello!
I've got one further problem:
Exception in thread "main" java.lang.IllegalArgumentException:
Structure class de.epdv.tools.usbwatch.libusb.StructUsbBus has
unknown size (ensure all fields are public)
at com.sun.jna.Structure.calculateSize(Structure.java:783)
As You can see, all my fields are public, so don't know what to do:
You need to define StructXXX.ByReference. The default
Structure.ByReference is only a tagging interface, not a definition.
public class StructUsbBus extends Structure implements Limits {
public static class ByReference extends StructUsbBus implements
Structure.ByReference { }
public StructUsbBus.ByReference prev, next;
public byte[] dirname = new byte[PATH_MAX + 1];
public StructUsbDevice.ByReference devices;
public int location;
public StructUsbDevice.ByReference root_dev;
}
You also need a definition of StructUsbDevice.ByReference, although
unless you actually need to access these fields, you can just as well
use Pointer.