[cffi-devel] bitfield structure members
Luís Oliveira
luismbo at gmail.com
Tue Jul 17 23:55:29 UTC 2007
Hello,
Sorry for the late reply.
On 26/06/07, dtwebb at postpro.net <dtwebb at postpro.net> wrote:
> struct mystuff
> {
> int foo;
> unsigned int bar : 1;
> }
In this case I'd just use (defcstruct mystuff (foo :int) (bar :uint))
and get the bit with (logand 1 (foreign-slot-value p 'mystuff 'bar)).
For more complex cases I'd need to check the ABI docs. In order to
achieve portability, it might be necessary to write some C glue code.
HTH,
--
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/
More information about the cffi-devel
mailing list