On Apr 19, 2008, at 6:13 PM, Peter Nabbefeld wrote:
Hello!
I've no knowledge about c, so please excuse for this silly question
about how to convert this struct from c:
C's not that complex, the K&R book is narrower than your pinky and the
section on structs and pointers readable within an hour.
struct usb_device {
struct usb_device *next, *prev;
Two pointers to struct. While they *could* be aliased to an array,
common usage suggests they're not.
Java type: Pointer, or Structure.ByReference.
char filename[PATH_MAX + 1];
struct usb_bus *bus;
struct usb_device_descriptor descriptor;
This is a nested struct. You can inline the fields directly, or make
a Java type usb_device_descriptor which extends
com.sun.jna.Structure. By default, structure fields within a
structure are nested. By contrast, structure arguments are treated as
struct* by default.
struct usb_config_descriptor *config;
Pointer, or Structure type, if you choose to define one.
void *dev; /* Darwin support */
u_int8_t devnum;
unsigned char num_children;
struct usb_device **children;
};