c-for-go
c-for-go copied to clipboard
Can't gernate struct with bit fields
struct bpf_insn {
__u8 code; /* opcode */
__u8 dst_reg:4; /* dest register */
__u8 src_reg:4; /* source register */
__s16 off; /* signed offset */
__s32 imm; /* signed immediate constant */
};
in cgo_helper.go
var cdst_reg_allocs *cgoAllocMap
ref51221c46.dst_reg, cdst_reg_allocs = (C.__u8)(x.DstReg), cgoAllocsUnknown
allocs51221c46.Borrow(cdst_reg_allocs)
But it gets ref51221c46.dst_reg undefined (type *_Ctype_struct_bpf_insn has no field or method dst_reg)
Related to Go1.16 ... https://go-review.googlesource.com/c/go/+/252378