I'm writing some python code to interact with a C DLL that uses structures extensively.
One of those structures contains nested structures. I know that this is not a problem for the ctypes module. The problem is that there is an often used structure that, in C, is defined via macro because it contains an "static" length array that can vary. That is confusing so here's 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 in a way that the resulting structure can be passed back and forth between my pythong script and the DLL.
BTW, I know that I can just hardcode the number in there but there are several instances of this "VAR" throughout that have different sizes.