Is there a SWIG module for Squeak?

Aaron J Reichow reic0024 at d.umn.edu
Thu Sep 6 23:47:14 UTC 2001


On Thu, 6 Sep 2001, Doug Way wrote:

> On the other hand, FFI (the Foreign Function Interface) may be
> sufficient for calling arbitrary C/C++ libraries from Squeak.  See
> http://minnow.cc.gatech.edu/squeak/1414
>
> (I've used SWIG before with Tcl and Python (see http://www.swig.org),
> but I haven't really played with FFI in Squeak much.  Is FFI basically
> equivalent to SWIG?)

Not really.  IIRC, SWIG generates wrapper code for language for which
there is a module.  It generates C extensions to those languages.  FFI
doesn't require any C coding, and simply loads a shared library.

The advantages, as I see it, for a SWIG for Squeak would be:
* speed- apparently FFI isn't that fast, compared to pluggable prims
* ease- my brief toying with FFI has been hit and miss.  There are really
no docs, but when it clicks, it's not all that hard.  but all the same,
SWIG would gen interface code for you, but with FFI, you still have to
make definitions in some methods, and more likely further wrap them in
Smalltalk.
* security- apparently the FFI plugin is kind of a security risk, as it
can load more or less any shared lib on a system.  With pluggable prims or
SWIG extension code, only those explicity .so/modules can be used.

It's a shame there are no docs for FFI, even a simple tutorial.

Regards,
Aaron

Aaron Reichow ::  Twin Ports ACM Pres ::  http://www.d.umn.edu/~reic0024/
"life, probably the biggest word i've ever said, that says a lot 'cause
there is a whole lot of words inside my head..." -- atmosphere








More information about the Squeak-dev mailing list