Well, it's simple for alignment and packing.
Structures are packed back to back in the initial allocation of an array, and the items within a structure are packed back to back, althought the initial structure seems to be correctly aligned.
Looks like we need to ensure that our structures are correctly formatted and aligned.
This structure is 9 bytes, while the equivalent in C/C++ would be 12 bytes:
type MyTestStruct
a as integer
b as byte
c as integer
endtype
(For those who don't know, the byte in the middle would be followed by 3 bytes of unused space to ensure that memory access is fastest - thats what is meant by packing. Alignment is similar - C/C++ use either 4 or 8 byte alignment/address is divisible by 4 or 8)
Oh well, it's better than nothing, even if it is a little inefficient to access unaligned memory.
Just change the code to this to fix it:
type MyTestStruct
a as integer
b as byte
fill1 as byte
fill2 as word
c as integer
endtype