9 messages in net.java.dev.jna.usersRe: [jna-users] Structure ... has un...
FromSent OnAttachments
Peter NabbefeldApr 20, 2008 3:33 am 
Timothy WallApr 20, 2008 4:52 am 
Peter NabbefeldApr 20, 2008 11:01 am 
Timothy WallApr 20, 2008 1:40 pm 
Peter NabbefeldApr 20, 2008 1:42 pm 
Timothy WallApr 20, 2008 2:11 pm 
Peter NabbefeldApr 20, 2008 10:38 pm 
Peter NabbefeldApr 20, 2008 10:38 pm 
Timothy WallApr 23, 2008 6:12 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 ... has unknown sizeActions...
From:Timothy Wall (twal@dev.java.net)
Date:Apr 20, 2008 4:52:00 am
List:net.java.dev.jna.users

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.