Hi all,
I've published libffidemo on Github,
https://github.com/PierceNg/libffidemo,
and DemoFFI on STH,
http://smalltalkhub.com/#!/~PierceNg/DemoFFI.
Together, they show how to use Pharo 5's Unified FFI to obtain an "opaque"
pointer to a C-level struct, in the two usual styles: passing in a pointer
pointer as a parameter, and via a pointer returned by a C function.
They also show how to retrieve an integer through the opaque pointer in two
usual styles: passing in a pointer to integer as a parameter, which involves
creating an integer value holder on the Smalltalk side, and via an integer
returned by a C function.
Apart from that, the library does nothing. :-)
To compile libffidemo for Pharo's use:
$ gcc -shared -m32 -o libffidemo.so libffidemo.c
I wrote these to figure out how to port NBSQLite3 from NativeBoost to the new
FFI. I hope others will find them helpful too.
Pierce