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 <estebanlm@gmail.com> 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 := FFITypeArray ofType: âvoid*â.
then you declare:
CXCursor class >> fieldsDesc "self rebuildFieldAccessors" ^ #( int kind; int xdata; VoidPointer3 data; )
that should work (never tried with void*, but I do not see why wouldnât work)
cheers, Esteban
ps: and yes, the idea is to extend the parser for doing this⦠but no time :(
On 09 Sep 2016, at 19:11, Ben Coman <btc@openinworld.com> wrote:
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: '' classVariableNames: '' package: 'Libclang'
CXCursor class >> fieldsDesc "self rebuildFieldAccessors" ^ #( int kind; int xdata; void *data[3]; )
an evaluated... CXCursor rebuildFieldAccessors
but it produces... Error: Unable to resolve external type: [ So it seems arrays inside structs are currently not handled ?
Now I read the typedef as "data is an array of three pointers to void", so how likely is it for something like this to work...
CXCursor class >> fieldsDesc "self rebuildFieldAccessors" ^ #( int kind; int xdata; void *data1; void *data2; void *data3; )
I'll experiment some more in the meantime.
cheers -ben