I have a structure which contains primitive fields (int, uint8, ...) and also pointers. These pointers often point to an array of different structures type in order to keep a deeply nested structure. For example in C:
struct A
{
int field1;
int field2;
struct B *fields3;
unsigned int countofb;
}
struct B
{
int anotherfield1;
int anotherfield2;
}
In python with ctypes I create a wrapper of the structures A and B.
iterating over _fields_ of structure A I reach the third field field3 and I get a ctype variable of type LP_struct_B .
The question is, is there a way, a function, a method of ctypes that convert a pointer to the pointed type ?
I need something like
a=A()
st=pointedtype(a.field3) # or also st = pointedtype2(LP_struct_B)
#desired output: st = struct_B
thanks