[Q] FFIPlugin for Unix

Bert Freudenberg bert at isgnw.CS.Uni-Magdeburg.De
Mon Jul 10 14:12:55 UTC 2000


On Sun, 9 Jul 2000, Pennell, David wrote:

> After a little trial and error, I also managed to build SqueakFFIPrims.so.
> I was a little surprised to find that it was dependant on a Cygnus
> package.

libffi provides very low level assembler routines that set up arguments
for calling a function according to the "calling convention" of the
platform. For example, MIPS/IRIX requires the first 8 floats to be passed
in FPU registers, while ints and others go into the stack. Same for return
values. It's very fortunate that with libff there exists a free library
that handles this. It currently supports:
        SunOS 4.1.3 & Solaris 2.x (Sparc v8)
        Irix 5.3 & 6.2 (System V/o32 & n32)
        Intel x86 - Linux (System V ABI)
        Alpha - Linux and OSF/1
        m68k - Linux (System V ABI)
        PowerPC - Linux (System V ABI)
        ARM - Linux (System V ABI)

The Squeak FFI code is based on the libffi-1.20 release, so you should use
this. I don't know yet what changes will be made in the upcoming 2.0
release.

> - Is liffi included on Linux (and other *nix's)?

No. Get it from http://sources.redhat.com/libffi/
or from Andreas' FFI directory
http://wwwisg.CS.Uni-Magdeburg.De/~raab/squeak/FFI/Unix/

> - What is the preferred way to add additional libs to link step? 
>   (I manually edited the Makefile)

You can define a special rule in the makefile. For example, there is a
rule for sqX%.o that adds the X rules. I added this for FFI:

../SqueakFFIPrims.so: $(OBJ) libffi.a
                $(SHLD) -o $@ $(OBJ) libffi.a

The configure script should be extended to locate the libffi directory.

> - Should this module be renamed FFIPlugin to be consistent with other
> plugins?

Yes. Although I'd prefer *Module instead of plugin ... this would match
the image methods listModules etc. There's also a name clash with the
Netscape Squeak plugin ...

-- Bert





More information about the Squeak-dev mailing list