oopForPointer in external plugins

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

oopForPointer in external plugins

johnmci

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.

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?


--
===========================================================================
John M. McIntosh <[hidden email]>   Twitter:  squeaker68882
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================




Reply | Threaded
Open this post in threaded view
|

Re: oopForPointer in external plugins

David T. Lewis
 
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.

Dave