I have found the problem with VoidPointer3 generating accessors.
No idea how to contribute back a fix but this is what I've found.
FFITypeArrayType>>annonymousClassCreator
^ String streamContents: [ :stream |
stream
nextPutAll: '(FFITypeArray ofType: ';
print: (self objectClass type isPointer ifTrue: [self externalTypeWithArity printString] ifFalse: ['#',self objectClass type class]);
nextPutAll: ' size: ';
print: self objectClass numberOfElements;
nextPutAll: ')' ]
Recalling that we are trying to come up with an accessor that can pull out a void*[3], this produces
'(FFITypeArray ofType: #FFIVoid size: 3)'
which produces an error as FFIVoid's size is undefined. In general, this will be wrong for any pointer type and will probably get the size calculation wrong.
Doing a little digging I find that
FFITypeArray>>ofType: aType size: aSize
delegates resolution of aType to FFIExternalType>>resolveType:aType and this can take all kinds of different things including the native type name.
It would be better if this generated the native name for pointers.
(FFITypeArray ofType: 'void*' size: 3)
So I changed it to:
FFITypeArrayType>>annonymousClassCreator
^ String streamContents: [ :stream |
stream
nextPutAll: '(FFITypeArray ofType: ';
print: (self objectClass type isPointer
ifTrue: [self externalTypeWithArity printString]
ifFalse: ['#',self objectClass type class]);
nextPutAll: ' size: ';
print: self objectClass numberOfElements;
nextPutAll: ')' ]
and this seems to work fine.
Onwards...
That���s great - it���s been kind of magical but a couple things have changed since you wrote it and some bugs have crept into ffi.
Right now I���m finding the generated accessor for the VoidPointer3 is actually generating a void 3 accessor and that doesn���t work. I spent all day yesterday tracking it to the accessor generating code.
Sent from the road