Hi, I’m trying to pass in a structure into a external function which takes in a pointer. Normally i would put the structure into a memory block and pass in the pointer to the memoryblock. However this structure is defined as follows in xcode
[code]typedef struct
{
// Positions in pixel space
// (e.g. a value of 100 indicates 100 pixels from the center)
vector_float2 position;
// Floating-point RGBA colors
vector_float4 color;
} AAPLVertex;[/code]
In Xojo it would be this
[code]Structure AAPLVertex
position as vector_float2
col as vector_float4
End Structure
Structure vector_float2
value1 as cgfloat
value2 as cgfloat
End Structure
Structure vector_float4
value1 as cgfloat
value2 as cgfloat
value3 as cgfloat
value4 as cgfloat
End Structure
[/code]
Populating a vector_float4 in xcode and printing sizeof(value) returns 16. In xojo the structure says it is size 16 and returns a “size” of 32 at runtime.
Populating a AAPLVertex in xcode sizeof(value) returns 32, in xojo it says the structure is 24 and the returned size at runtime is 48.
What am i doing wrong that i get such different values? Where is the other 8 bytes going in xcode?
If i was to populate a memory block with an array of AAPLVertex datas how would I write it out?
Running 64bit on macOS 10.12
Cheers