[UFFI-Users] bitfields in structs

Reini Urban rurban at x-ray.at
Tue May 4 16:42:25 MDT 2004


Kevin Rosenberg schrieb:
> rif wrote:
>>I assume there's no direct way to wrap this in UFFI?  In fact, can
>>this even be done on top of most UFFI's?  Fortunately, I don't *think*
>>I need to actually access any of the fields in this thing --- I think
>>I can get by with just having the sxpinfo_struct contained an
>>:unsigned-int, and I guess if I need bit access I could write
>>accessors in C or something?
> 
> 
> UFFI does not have any support for bit fields. As for other FFI's, you
> can read their individual documentation to check. I don't know without
> me doing similar research.

I never came around such a special bitfield ffi helper in any FFI so 
far, since it's trivial to convert such a bitmask to shortint, longint, 
quad or similar native C type, pass it to the external function and 
convert it back then.

> As for bit access, you could either use a C wrapper or treat the bit
> fields as an conglomerated integer of some width and then twidlle the
> bits with CL's myriad of bit accessors.

-- 
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/



More information about the UFFI-Users mailing list