2 messages in net.java.dev.jna.usersQuestion about converting a C struct ...
FromSent OnAttachments
Peter NabbefeldApr 19, 2008 3:12 pm 
Timothy WallApr 19, 2008 4:04 pm 
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:Question about converting a C struct (from linuxusb)Actions...
From:Peter Nabbefeld (Pete@gmx.de)
Date:Apr 19, 2008 3:12:54 pm
List:net.java.dev.jna.users

Hello!

I've no knowledge about c, so please excuse for this silly question about how to convert this struct from c:

struct usb_device { struct usb_device *next, *prev;

char filename[PATH_MAX + 1];

struct usb_bus *bus;

struct usb_device_descriptor descriptor; struct usb_config_descriptor *config;

void *dev; /* Darwin support */

u_int8_t devnum;

unsigned char num_children; struct usb_device **children; };

I'd usually think, a struct would be a reference just by its meaning, so the line "struct usb_device *next, *prev;" would refer to arrays. However, this seems not to make sense, as the line will refer to a linked list. So the second question is about the line "struct usb_device_descriptor descriptor;" If the first line does not refer to arrays - do I have to inline all the fields of usb_device_descriptor then? I.e., do I have to write

UsbDevice[] next, prev; ... UsbDeviceDescriptor descriptor; UsbConfigDescriptor[] config; ...

or

UsbDevice next, prev; ... byte ... // duplicate all the fields of UsbDeviceDescriptor .... UsbConfigDescriptor config; ...

or am I totally wrong?

Kind regards