1
我有一个包含原始字段(int,uint8,...)和指针的结构。 这些指针通常指向一个不同结构类型的数组,以保持深度嵌套结构。 例如,在C:python ctypes:从指针变量中获取指针类型
struct A
{
int field1;
int field2;
struct B *fields3;
unsigned int countofb;
}
struct B
{
int anotherfield1;
int anotherfield2;
}
在蟒与ctypes的创建的结构的一个包装和B. 迭代以上结构A的_fields_
我到达第三字段field3
和我得到LP_struct_B
类型的CTYPE变量。
问题是,有没有一种方法,一个函数,ctypes的方法将指针转换为指向类型?
我需要这样的东西
a=A()
st=pointedtype(a.field3) # or also st = pointedtype2(LP_struct_B)
#desired output: st = struct_B
感谢