chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] how to declare foreign variably size structs?


From: Geoffrey
Subject: [Chicken-users] how to declare foreign variably size structs?
Date: Fri, 21 Jun 2013 05:58:52 +1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6

Hi I am trying to declare of variably sized c struct as a foreign declaration.

The one i am after is:
struct inotify_event
{
  int wd;                /* Watch descriptor.  */
  uint32_t mask;        /* Watch mask.  */
  uint32_t cookie;        /* Cookie to synchronize two events.  */
  uint32_t len;                /* Length (including NULs) of name.  */
  char name __flexarr;        /* Name.  */
};

Note that name field is variably sized. I believe in C you would allocate a larger block of memory and then cast it to  (inotify_event*). 

By the skills of copy and paste i can do fixed size,and i can do a blob. But not a variable struct.

Some help would be appreciated.

Thanks

reply via email to

[Prev in Thread] Current Thread [Next in Thread]