TestInterpreterPlugin help

Stephan Rudlof sr at evolgo.de
Wed Jan 9 22:47:59 UTC 2002


Somewhat late, since I'm sitting in a hotel (working outside and had big
problems to connect...), but here are a few hints:

Joshua 'Schwa' Gargus wrote:
> 
> Hello,
> 
> I'm having trouble passing around a pointer between interpreted Squeak
> code and compiled plugin code.  I have a primitive method that returns
> a pointer like this:
> 
> ^ aPtr asOop: Unsigned
> 
> This seems to work fine; depending on the value, I get either a
> SmallInteger or a LargePositiveInteger.  The problem arises when I try
> to pass this into another primitive method that looks like this:
> 

> primNeedPointer: aPtr
> 
>     self
>         primitive: 'primNeedPointer'
>         parameters: #(Unsigned)
>     "more stuff..."
> 
> The generated C code causing the failure is:
> 
> interpreterProxy->success(interpreterProxy->isKindOf(interpreterProxy->stackValue(0), "Unsigned"));
> 
> Looking at the code for isKindOf(), it is clear why it fails: the
> object (a SmallInteger or LargePositiveInteger) is not an instance
> of Unsigned or one of its subclasses.

You could use "Integer" here.

But there is another problem: if you have a LargeInteger as 'ptr' its oop
may have changed between the calls of the two prims.

Greetings,

Stephan

> 
> I followed the directions on:
> http://minnow.cc.gatech.edu/squeak/850
> as closely as possible.  What am I doing wrong?
> 
> Thanks,
> Joshua

-- 
Stephan Rudlof (sr at evolgo.de)
   "Genius doesn't work on an assembly line basis.
    You can't simply say, 'Today I will be brilliant.'"
    -- Kirk, "The Ultimate Computer", stardate 4731.3




More information about the Squeak-dev mailing list