[Vm-dev] oopForPointer in external plugins

David T. Lewis lewis at mail.msen.com
Mon Dec 21 00:03:41 UTC 2009

On Sun, Dec 20, 2009 at 03:26:13PM -0800, John M McIntosh wrote:
> Ok I closed 
> http://bugs.squeak.org/view.php?id=7431
> because it seemed my ft2plugin image was data and didn't have the latest interpreter changes. 

Phew, thanks. You had me scratching my head on this one ;-)

> However now I have 
> 	byteSize = interpreterProxy->byteSizeOf((oopForPointer( aByteArray ) - 4));
> but since 
> # define oopForPointer(ptr)		((sqInt)(((char *)(ptr)) - (sqMemoryBase)))
> then  sqMemoryBase becomes an issue because the external plugin is not linkable due to the missing reference. 
> So do we need to add something to the VM interpreter api  or will I see if we can weak-link this var in?

I think it will work. There are several plugins with oopForPointer() in
the Unix platforms code, and I think they work as external plugins
(grep -rl oopForPointer platforms/unix).

Easy check is to build it internal first to get it working, then
make it external. If there is an undefined reference, you'll see
an error message to that effect on the console output. Symptoms on
the image side are that it will look like the plugin could not be
found, but the actual problem is that the plugin fails to load if
it contains any unresolved references.


More information about the Vm-dev mailing list