Last updated at 1:27 pm UTC on 23 January 2006
Named Primitives a.k.a. Pluggable Primitives a.k.a. Plugins
from Andrew Greenberg's named primitive tutorial:
"Squeak Central has provided a new primitive interface for extending the VM without having to modify it. A pluggable primitive is called by name, not by number, and its code can reside in an external library (DSO on Unix, DLL on Windows, Shared Libraries on MacOS) or in the VM library itself. An example is FFT>>pluginTest which is a factor 60-100 times faster than the regular (interpreted) FFT."
(note: this page has a lot of overlap with Maximum Squeak. Perhaps someone with a bit more gumption could unify them)
- Andrew Greenberg's named primitive tutorial
- "Extending the Virtual Machine" chapter of the NuBlue Book
- also written by Andrew Greenberg, this chapter includes the same example as the tutorial, as well as a wealth of other information about writing plugins. Don't miss this one! Remember that TestPlugin ahs since been renamed to SmartSyntaxInterpreterPlugin
- Ragnar Hojland Espinosa and the Wonderful Land Of Pluginia
- The Do-It-Yourself Guide to Squeak Primitives by Steven Travis Pope - note that VM plugins have almost completely obsoleted this approach and that use of VMMaker is now advised. That doesn't mean you shouldn't read this valuable page.
- recommended by Andrew Greenberg for after you finish his tutorial
- Extending Squeak by Writing Plugins by Ned Konz
- Details Ned's experiences in incorporating existing C code into a Squeak plugin. Uses SmartSyntaxInterpreterPlugin (formerly TestInterpreterPlugin), which was written by Andrew Greenberg to simplify the plugin syntax, particularly with respect to stack arguments passed to the plugin.
- Specifications For Named Primitives provides some extra information about SmartSyntaxInterpreterPlugin
- VMMaker describes the VMMaker package by tim Rowledge, which greatly facilitates the process of building Squeak VMs and plugins for a variety of platforms.
Andrew Greenberg's notes were helpful for getting started in using the new named primitive facilities.
As an addendum for those on Linux or another Unixy platform, the commands I used to generate the shared library module for Foo.c were as follows on RedHat Linux 5.2:
$ cd /usr/local/squeak
# this line must reference your squeak source
$ cc -c -I/usr/local/src/squeak-2.3/src Foo.c
$ ld -shared -o Foo.so Foo.o
# I used ld -G -o Foo.so Foo.o on Solaris - *405*
Thanks to the Squeak Team for this new facility and to Andrew for the notes! I think the notes should be added to the Squeak Swiki for future reference.