Hi,
I'm trying to play with new UFFI system. It looks much easier then
NativeBoost, but unfortunately its hard to find any docs or examples.
I have problem with casting void* (ExternalAddress) into smalltalk object if
there is no hardcoded type in ffi method. And I really dislike the idea of
making many ffi methods, one for each required type.
In this example i can't understand how to make something like `address
castTo: type`
FFIExternalObject subclass: #Iterator
Iterator >> asCollectionOfType: aTypeName
| result address type |
result := OrderedCollection new.
address := ExternalAddress new.
type := FFIExternalType resolveType: aTypeName.
[self iterator_next: address] whileTrue: [
result add: (address castTo: type).
].
^result
Iterator >> iterator_next: data
^ self ffiCall: #(Boolean iterator_next (Iterator self, void** data))
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html