Macintosh Advice Sought: Squeak VM as NS Plugin

John.Maloney at disney.com John.Maloney at disney.com
Fri Feb 4 23:30:17 UTC 2000


Folks:

This is a plea for help from any good Macintosh programmers in Squeakland.

I have been working on a version of the Squeak VM to be run as a
Netscape Plugin on the Mac. (Yes, running Squeaklets in the browser
will soon be possible.)

However, I've run into a snag with the CodeFragmentManager that
a good Macintosh hacker might be able to help me with.

Background:

The Squeak VM supports named primitives. These primitives often
live in independent shared library files, but they can also
reside in the VM executable itself. Such "built-in" named
primitives are called from Squeak using the form:

	<primitive: 'myBuiltInPrimitive'>

The absence of a module name means that the primitive is expected
to have been linked into the VM. Examples of such primitives include
the FloatArray and FFT primitives.

To call a named primitive, you must first locate the library
containing the primitive, then look up the primitive name within
that fragment. The result is a pointer to a function that can be
invoked to run that primitive. In the normal VM, the library
for the builtin primitives is found on the Mac by searching for
a fragment named "SqueakVMPrims", which is the name of the VM
executable fragment.

The Problem:

Unfortunately, the above technique doesn't work when the VM is
running as a Netscape plugin. I'm not why not, but I suspect it is
because Netscape does not load the plugin as an ordinary shared
library. So my problem is, how can I get a "connection id" for
the VM code fragment when running as a NS plugin? I have not found
an API call that allows me to map from a function pointer to to
fragment that contains that function, although it seems like there
*should* be such a function.

One approach I've tried that has not worked (so far) is to use
the GetDiskFragment() call to look up the code fragment of the
Squeak Plugin VM as a file in the Netscape Plug-ins directory.
I can load this file by force, but the application crashes when
I try to look up a function within it.

Any help would be VERY much appreciated... Thanks.

	-- John






More information about the Squeak-dev mailing list