1
私はプリミティブフィールド(int、uint8、...)とポインタも含む構造体を持っています。 これらのポインタは、深くネストされた構造を維持するために、異なる構造型の配列を指すことがよくあります。 たとえばCで:ctypesのとPythonでpython ctypes:ポインター変数からポインティング型を取得
struct A
{
int field1;
int field2;
struct B *fields3;
unsigned int countofb;
}
struct B
{
int anotherfield1;
int anotherfield2;
}
IはAとB は、構造Aの_fields_
を反復構造のラッパーを作成Iは第3フィールドfield3
に達し、I型LP_struct_B
のCTYPE変数を取得します。
質問は、ポインター型にポインターを変換する方法、関数、ctypesの方法はありますか?
私は
a=A()
st=pointedtype(a.field3) # or also st = pointedtype2(LP_struct_B)
#desired output: st = struct_B
おかげ