[plt-scheme] FFI Question: C-Structures with byte blocks.
Perhaps this thread will help you?
http://list.cs.brown.edu/pipermail/plt-scheme/2006-April/012663.html
Ray wrote:
> Question on using the FFI.
>
> Have made some minimal headway in binding to libusb.
>
> Given the following C structure, what should my define-cstruct look
> like? For now, assume the goal is to extract the null terminated
> directory name from dirname and to follow the usb_bus *next linked list
> chain. i.e. the other structure values can be ignored.
>
> Its how to declare the "block" of char for dirname I'm unsure about.
>
> Given:
>
> struct usb_bus {
> struct usb_bus *next, *prev;
>
> char dirname[PATH_MAX + 1];
>
> struct usb_device *devices;
> u_int32_t location;
>
> struct usb_device *root_dev;
> };
>
> How do get the structure layout to work when dirname is a block of 4097 bytes. (PATH_MAX = 4096 in limits.h)
>
> (define-cstruct _buss_struct
> ((next _pointer)
> (previous _pointer)
> (dirname (_bytes o 4097)) ;; not what I really want to do here ??
> (devices _pointer)
> (location _int)
> (root_dev _pointer)))
>
>
> Thanks
>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
>
>