I am trying to create Perl6 bindings for Cgraph, and one of the structs has bit fields set for some of its attributes with values under 8. How should I represent that in my module?
I have tried defining a custom type using the is nativesize(x)
trait, but CStructs only support types that are a multiple of 8 bits wide.
C example code:
struct Agtag_s {
unsigned objtype:2;
}
What I tried:
my native objtype is repr('P6int') is Int is nativesize(2) is export { }
class Agtag is repr('CStruct') is export {
has objtype $.object-type;
}
Trying to use my module with that code fails with the following error message:
CStruct only supports native types that are a multiple of 8 bits wide (was passed: 2)