Autoit doesn't allow arrays of user defined types inside other structs. One way to it is by allocating a raw block of memory sized to your array, and alias your way into it, kind of like this:
$tagMYSTRUCT = "int code; char msg[10];"
$mystruct = ArrayStruct($tagMYSTRUCT, 4)
$fourth_element = getElement($mystruct, 3, $tagMYSTRUCT) ; $fourth_element is an alias of '$mystruct[3]'
DllStructSetData($fourth_element, "code", 3);
DllCall(...., "struct*", $mystruct)
Func ArrayStruct($tagStruct, $numElements)
$sizeOfMyStruct = DllStructGetSize(DllStructCreate($tagMYSTRUCT)) // assumes end padding is included
$numElements = 4
$bytesNeeded = $numElements * $sizeOfMyStruct
return DllStructCreate("byte[" & $bytesNeeded & "]")
EndFunc
Func GetElement($Struct, $Element, $tagSTRUCT)
return DllStructCreate($tagSTRUCT, DllStructGetPointer($Struct) + $Element * DllStructGetSize(DllStructCreate($tagStruct)))
EndFunc
Its the C equivalent of doing this:
typedef struct
{
int code;
char msg[10];
} MyStruct;
void example() {
MyStruct structs[10];
something(structs);
//or
MyStruct * ptrstructs = (MyStruct*) malloc(sizeof MyStruct * 10);
something(ptrstructs);
}
void something(MyStruct input[]) {}