[Pyrex] How to declare the structure with bit-fields in pyrex?

Robert Bradshaw robertwb at math.washington.edu
Sun Apr 20 03:28:29 CEST 2008


On Apr 19, 2008, at 3:55 PM, Greg Ewing wrote:

> Yong Sun wrote:
>
>> struct Test {
>> unsigned int head : 4
>> unsigned int tail : 28
>> };
>>
>> How could I declare it in pyrex?
>
> Currently, you can't. However, if the struct is defined
> in an external header, you don't need to -- just leave
> the bit fields out in the Pyrex declaration. The C
> compiler will see the actual definition in the header.

Also, if the above struct is defined in a header file, you can just  
declare the bit-field members to be (unsigned) ints and the correct C  
code will be generated (which will be handled just fine from them on).

- Robert



More information about the Pyrex mailing list