[squeak-dev] FFI callbacks

Craig Latta craig at netjam.org
Thu Sep 3 12:22:08 UTC 2015


Hi all--

     I'd like to use a C shared library via FFI from Squeak or Pharo.
Specifically, I want to call a C function which takes as one of its
parameters a pointer to an array of callback function addresses. Does
one of the FFI approaches floating around handle that, and provide a
relatively pleasant mapping between Smalltalk block closures and C
callback function addresses?

     I was doing this so far in GemStone, but apparently its FFI only
supports passing callback function addresses one at a time as direct
parameters of C callouts. I suppose I could write a wrapper C library
around the one I really want to use, that provides the callback setup
interface that GemStone expects, but whenever I have to write actual C
code I start to think "Hm, why don't I just use a Smalltalk VM for which
I have the source?" :)  All the fancy distributed object-database stuff
that my project also wants can wait for a bit.


     thanks!

-C

--
Craig Latta
netjam.org
+31   6 2757 7177 (SMS ok)
+ 1 415  287 3547 (no SMS)



More information about the Squeak-dev mailing list