I'm seeking some support for Part 5 of my FFI tutorial
http://blog.openinworld.com/2016/09/pharo-libclang-ffi-part-5-client-data-and-recursive-visitorcallbacks/

where I'm trying to replicate some C code where:
* client_data is a void pointer, and an argument to a callout function
* a reference to some data (an int, or a struct) is passed to the
callout function as the client_data
* the callout function passes that same client_data to a callback
function which casts the client-data to the required type

How can I replicate that with UFFI?  The key thing is that *any* type
can be passed via client_data.  So for a normal Pharo object defined
like...

Object subclass: MyObject
    instanceVariables: 'x y'

myobject := MyObject new x:3 y:4.

I want to pass a reference to myobject to the callout, and in the
callback dereference client_data to get myobject that I can operate on
normally.

Is this possible with current infrastructure, or would it need
something new like FFIInternalPinnedReference to wrap myobject for the
callout and unwrap it in the callback?

cheers -ben

Reply via email to