On Sun, 12 Feb 2006, Joel VanderWerf wrote: > ara.t.howard / noaa.gov wrote: >> >> if one has: >> >> >> struct flock { >> ... >> short l_type; /* Type of lock: F_RDLCK, >> F_WRLCK, F_UNLCK */ >> short l_whence; /* How to interpret l_start: >> SEEK_SET, SEEK_CUR, SEEK_END */ >> off_t l_start; /* Starting offset for lock */ >> off_t l_len; /* Number of bytes to lock */ >> pid_t l_pid; /* PID of process blocking our lock >> (F_GETLK only) */ >> ... >> }; >> >> can this structure be desribed using ruby/dl? i'm worried that the struct >> method assumes the fields are in order which, in the case of the flock >> structure, they may not be. > > I don't understand. If the flock struct fields are not in a predictable > order, how do you access them in C? that's what to compiler does - it's why one must say sizeof(mystruct) vs. sizeof(int) + sizeof(float) assuming struct mystruct { int i; float f; }; i recently learned of the offsetof macro which tells you this info. regards. -a -- happiness is not something ready-made. it comes from your own actions. - h.h. the 14th dali lama