Re: [Pharo-users] arrays with FFI structs

2016-09-09 Thread Esteban Lorenzano
With UFFI, what you’ll do for “being OO” is to: 1) extend FFIExternalStructure 2) then use your class adding methods that use the structure into it (using “self” as argument). For example: FFIExternalStructure subclass: #MyStruct. MyStruct>>#method1: arg ^ self ffiCall: #(int funct

Re: [Pharo-users] arrays with FFI structs

2016-09-09 Thread Ben Coman
On Sat, Sep 10, 2016 at 8:47 AM, Pierce Ng wrote: > On Sat, Sep 10, 2016 at 01:11:18AM +0800, Ben Coman wrote: >> Are arrays within structs handled? I have a C type declaration... > > Ben, > > Is it possible to write C functions to manipulate these structures, build > these > functions into a sha

Re: [Pharo-users] arrays with FFI structs

2016-09-09 Thread Pierce Ng
On Sat, Sep 10, 2016 at 01:11:18AM +0800, Ben Coman wrote: > Are arrays within structs handled? I have a C type declaration... Ben, Is it possible to write C functions to manipulate these structures, build these functions into a shared library, and call the functions from Pharo? More "object orie

Re: [Pharo-users] arrays with FFI structs

2016-09-09 Thread Esteban Lorenzano
by the way, this is a new feature of UFFI… old NB didn’t have it :) > On 09 Sep 2016, at 19:17, Esteban Lorenzano wrote: > > not very well (I didn’t adapted the parser or optimised it, but it works fine > :P). > you need to declare a type: > > CXCursor class>>initiallize > VoidPointer3

Re: [Pharo-users] arrays with FFI structs

2016-09-09 Thread Esteban Lorenzano
not very well (I didn’t adapted the parser or optimised it, but it works fine :P). you need to declare a type: CXCursor class>>initiallize VoidPointer3 := FFITypeArray ofType: ‘void*’. then you declare: CXCursor class >> fieldsDesc "self rebuildFieldAccessors" ^ #(

[Pharo-users] arrays with FFI structs

2016-09-09 Thread Ben Coman
Are arrays within structs handled? I have a C type declaration... typedef struct { enum CXCursorKind kind; int xdata; const void *data[3]; } CXCursor; which for the moment I've simplified the enum and defined... FFIExternalStructure subclass: #CXCursor instanceVariableNames: