Hi Merwan,I tested this on Pharo 6 and it is working in Windows. However, in 32 bits Window doubles have an 8 byte alignment, unlike Linux where they have a 4 byte alignment.Can you try doing the following before performing the ffi call in Windows, if you are moving an image from Linux or OS X:
Vec3 rebuildFieldAccessors.
Position rebuildFieldAccessors.Best regards,Ronie2016-07-05 11:11 GMT+02:00 Merwan Ouddane <merwanouddane@gmail.com>:MerwanCheers,Any clues ?Sorry for the long / messy mail :pThe ffi call:I declared the Double3 type for the array inside Vec3:In PharoBut I can't make the nested structure work.Hi,
I have an issue whith nested structures.
I made some "dummy" structures in c:
And a "dummy" function to fill it:
typedef struct vec3 {
�������� double data[3];
} vec3;
typedef struct position {
�������� int i;
�������� vec3 vec;
} position;
void fillStruct(position *position)
{
������ position -> i = 19;
������ (position -> vec).data[0] = 1;
������ (position -> vec).data[1] = 2;
������ (position -> vec).data[2] = 3;
}
The "i" is correctly set to 19 but I have values that doesn't make any sense in the vec3 structure.
Double3 := FFITypeArray ofType: 'double' size: 3
Vec3>>fieldsDesc
������ ^ #(
������ Double3 v;
)And the position:
Position>>fieldsDesc
������ ^ #(
������ int i;
������ Vec3 vec;
)
^ self ffiCall: #(void fillStruct(Position *position)) module: 'Test.dll'