get_field_details

Definition: include cffi.e
integer {offset, size, sign} = get_field_details(integer id, string name)
Description: Get the low level details of a named field in a structure previously defined by define_struct().
Comments: It is normally sufficient to use set_struct_field() and get_struct_field(), however this routine may be necessary to deal with arrays of structures, nested or hybrid structures, unions, etc.

While it is reasonable to suggest that compiling even several hundred structs and functions, once at startup, is unlikely to cause a measurable performance issue, the same cannot in the general case be said for repeated named lookups on individual fields. Use of this routine prior to a tight inner loop might offer significant performance benefits - but unless you are going to be calling something more than a million times I would advise you not to bother.

The offset would normally be added to a value from allocate_struct() or similar.
The size and sign can be passed to peekNS(), and size to pokeN().
Example:
include cffi.e
integer idMBP = define_struct(...)
atom pMBP = allocate_struct(idMBP)
..
atom pTitle = get_struct_field(idMBP,pMBP,"lpszText")
?peek_string(pTitle)
constant {title_offset,tsize,tsign} = get_field_details(idMBP,"lpszText")
?peek_string(peekNS(pMBP+title_offset,tsize,tsign))
See Also: define_struct, set_struct_field, get_struct_field, allocate_struct, peek, poke