I am writing python code to interact with a C DLL that makes extensive use of structures.
One of these structures contains nested structures. I know this is not a problem for the ctypes module. The problem is that there is a commonly used structure, which in C is defined by a macro, because it contains an array of static length that can change. This is misleading, so here is some code
struct VarHdr {
int size;
}
#define VAR(size) \
struct Var {
VarHdr hdr;
unsigned char Array[(size)];
}
Then it is used in other structures like this.
struct MySruct {
int foo;
VAR(20) stuffArray;
}
The question then becomes, how can I emulate this in Python so that the resulting structure can be passed between my pythong script and the DLL.
, , , "VAR", .