Re: [Pharo-users] [UFFI] Using a nested structure

2016-07-11 Thread Esteban Lorenzano
Hi, I uploaded the fix for it. it will be integrated soon. Esteban > On 11 Jul 2016, at 13:13, Henrik Johansen > wrote: > > The alignment calculation of external enums is wrong, it should be > > FFIExternalEnumerationType >> externalTypeAlignment > ^ self representationType externalT

Re: [Pharo-users] [UFFI] Using a nested structure

2016-07-11 Thread Henrik Johansen
The alignment calculation of external enums is wrong, it should be FFIExternalEnumerationType >> externalTypeAlignment ^ self representationType externalTypeAlignment It only manifests for 32bit platforms on Windows since that's the only one with a pointer alignment (which superclass FF

Re: [Pharo-users] [UFFI] Using a nested structure

2016-07-08 Thread Merwan Ouddane
Yes I did. Have you tried on windows ? Merwan On 08/07/2016 21:20, Esteban Lorenzano wrote: it works fine for me: Struct>>b "This method was automatically generated" ^Enum fromInteger: (handle unsignedLongAt: 5) Struct>>b: anObject "This method was automatically generated" handle unsignedLon

Re: [Pharo-users] [UFFI] Using a nested structure

2016-07-08 Thread Esteban Lorenzano
it works fine for me: Struct>>b "This method was automatically generated" ^Enum fromInteger: (handle unsignedLongAt: 5) Struct>>b: anObject "This method was automatically generated" handle unsignedLongAt: 5 put: anObject value Struct>>c "This method was a

Re: [Pharo-users] [UFFI] Using a nested structure

2016-07-08 Thread Merwan Ouddane
Struct >> fieldsDesc ^#( void* a; Enum b; Enum c; ) Enum >> enumDecl ^ #( TEST 1 ) I joined a .st with the struct and the enum, the package name is FFITest. Merwan On 08/07/2016 20:14, Esteban Lorenzano wrote: that still does not helps… show me the code! Esteban On 08 Ju

Re: [Pharo-users] [UFFI] Using a nested structure

2016-07-08 Thread Esteban Lorenzano
that still does not helps… show me the code! Esteban > On 08 Jul 2016, at 20:09, Merwan Ouddane wrote: > > Sorry not unsigned longs but enumerations > > On Fri, Jul 8, 2016 at 10:09 AM, Esteban Lorenzano > wrote: > how do you declare this? > >> On 08 Jul 2016, at

Re: [Pharo-users] [UFFI] Using a nested structure

2016-07-08 Thread Merwan Ouddane
Sorry not unsigned longs but enumerations On Fri, Jul 8, 2016 at 10:09 AM, Esteban Lorenzano wrote: > how do you declare this? > > On 08 Jul 2016, at 10:01, Merwan Ouddane wrote: > > I spoke too fast ^^' > > struct Test { > void * ptr; > insigned long i; > insigned long j; > } > > Real si

Re: [Pharo-users] [UFFI] Using a nested structure

2016-07-08 Thread Esteban Lorenzano
how do you declare this? > On 08 Jul 2016, at 10:01, Merwan Ouddane wrote: > > I spoke too fast ^^' > > struct Test { > void * ptr; > insigned long i; > insigned long j; > } > > Real size is 12, UFFI counts 24 > > Merwan > > > Le 7 juil. 2016 10:02, "Merwan Ouddane"

Re: [Pharo-users] [UFFI] Using a nested structure

2016-07-08 Thread Merwan Ouddane
I spoke too fast ^^' struct Test { void * ptr; insigned long i; insigned long j; } Real size is 12, UFFI counts 24 Merwan Le 7 juil. 2016 10:02, "Merwan Ouddane" a écrit : > Now it is working, thank you :) > > On Thu, Jul 7, 2016 at 8:42 AM, Esteban Lorenzano > wrote: > >> Hi, >> >> >

Re: [Pharo-users] [UFFI] Using a nested structure

2016-07-07 Thread Merwan Ouddane
Now it is working, thank you :) On Thu, Jul 7, 2016 at 8:42 AM, Esteban Lorenzano wrote: > Hi, > > > On 07 Jul 2016, at 01:54, Ben Coman wrote: > > > > On Thu, Jul 7, 2016 at 12:58 AM, Merwan Ouddane > wrote: > >> PS: for the first example, the alignment is not respected, the vec3 > >> structu

Re: [Pharo-users] [UFFI] Using a nested structure

2016-07-06 Thread Esteban Lorenzano
Hi, > On 07 Jul 2016, at 01:54, Ben Coman wrote: > > On Thu, Jul 7, 2016 at 12:58 AM, Merwan Ouddane > wrote: >> PS: for the first example, the alignment is not respected, the vec3 >> structure is starting at 9 but uffi is fetching it at 5 > > Hi Esteban, > > Is it possible to get a feature

Re: [Pharo-users] [UFFI] Using a nested structure

2016-07-06 Thread Ben Coman
On Thu, Jul 7, 2016 at 12:58 AM, Merwan Ouddane wrote: > PS: for the first example, the alignment is not respected, the vec3 > structure is starting at 9 but uffi is fetching it at 5 Hi Esteban, Is it possible to get a feature or a recipe to output the sizeof or offset of fields in types as unde

Re: [Pharo-users] [UFFI] Using a nested structure

2016-07-06 Thread Merwan Ouddane
PS: for the first example, the alignment is not respected, the vec3 structure is starting at 9 but uffi is fetching it at 5 On 06/07/2016 17:55, Merwan Ouddane wrote: Another test: I replaced double by integer, for visibility... typedef struct vec3 { int data[3]; } vec3; add a second vec3

Re: [Pharo-users] [UFFI] Using a nested structure

2016-07-06 Thread Merwan Ouddane
Another test: I replaced double by integer, for visibility... typedef struct vec3 { int data[3]; } vec3; add a second vec3 to position: typedef struct position { int i; vec3 vec; vec3 vec2; } position; Now in pharo: Position >> fieldsDesc "self rebuildFieldAccessors" ^ #(

Re: [Pharo-users] [UFFI] Using a nested structure

2016-07-05 Thread Ronie Salgado
I compiled the DLL using Visual Studio 2015 Community Edition. Later I will check with mingw. 2016-07-05 14:58 GMT+02:00 Merwan Ouddane : > Using codeblocks, mine are: > > mingw32-g++.exe -m32 -DBUILD_DLL -c main.cpp -o obj\Release\main.o > mingw32-g++.exe -shared -Wl,--output-def=bin\Release\lib

Re: [Pharo-users] [UFFI] Using a nested structure

2016-07-05 Thread Merwan Ouddane
Using codeblocks, mine are: mingw32-g++.exe -m32 -DBUILD_DLL -c main.cpp -o obj\Release\main.o mingw32-g++.exe -shared -Wl,--output-def=bin\Release\libTest.def -Wl,--out-implib=bin\Release\libTest.a -Wl,--dll obj\Release\main.o -o bin\Release\Test.dll -s -m32 On Tue, Jul 5, 2016 at 2:52 PM, Me

Re: [Pharo-users] [UFFI] Using a nested structure

2016-07-05 Thread Merwan Ouddane
I am not moving from another plateform :/ I tried it in pharo 6 and I it didn't work either. It could be my dll. What is your compilation line for the dll ? Thanks you, Merwan On Tue, Jul 5, 2016 at 2:14 PM, Ronie Salgado wrote: > Hi Merwan, > > I tested this on Pharo 6 and it is working in W

Re: [Pharo-users] [UFFI] Using a nested structure

2016-07-05 Thread Ronie Salgado
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:

[Pharo-users] [UFFI] Using a nested structure

2016-07-05 Thread Merwan Ouddane
Hi, I have an issue whith nested structures. I made some "dummy" structures in c: typedef struct vec3 { double data[3]; } vec3; typedef struct position { int i; vec3 vec; } position; And a "dummy" function to fill it: void fillStruct(position *position) { position -> i = 19;