Hi Ken,

On Tue, Mar 15, 2011 at 3:19 PM, Ken Treis <[email protected]> wrote:

> For kicks, I tried running the GemStone tools in a Cog VM. It *almost*
> works. Apparently this sort of call:
>
> > apiGciPerform: anOopType a: aString a: anArray a: anInteger
> >
> >       <apicall: OopType64 'GciPerform' (OopType64 char* ulong long) >
> >       ^self externalCallFailed
>
> ... works differently now. In the old (non-Cog) VM, it return an instance
> of OopType64. In Cog, it returns a SmallInteger.
>
> The function itself returns a uint64_t, so apparently the OopType64 class
> (a subclass of ExternalStructure) is being used to trick the FFI into
> automatically wrapping the return value in the way we want.
>
> 1. Is this trick no longer supported/legit (assuming it ever was)?
>

I expect that if the standard FFI plugin answers an instance of OopType64
then you've found a bug in the ReentrantFFIPlugin.  If you're brave you'll
have a look at both plugins and try and verify that that's the case.  But I
have to say that the FFI plugins are not simple.


> 2. Is there a better way to accomplish the same thing, or do we just have
> to do the wrapping ourselves now?
>

Difficult to answer without answering 1.  I'm guessing that 2. is a
non-issue and that the real answer is to fix the bug in ReentrantFFIPlugin.
 For that I'd like to enlist your help.  You have the patient on the table
as it were and I don't have the time to attempt to reproduce the example and
fix it now.

>
> I'm pretty new to the FFI, so forgive me if the premise is wrong. All I
> know is that it doesn't work the way it used to. :)
>

The premise is right.  The ReentrantFFIPlugin is supposed to be a
plug-and-play replacement for the old FFIPlugin (at least in Cog; a little
more work may be necessary to get it to work in the standard VM).

let me know how you get on.

best,
Eliot

>
> --
> Ken Treis
> Miriam Technologies, Inc.
>
>
>

Reply via email to