[squeak-dev] Re: [Cuis] FFI problem with ExternalAddress
Andreas Raab
andreas.raab at gmx.de
Tue Feb 16 17:16:16 UTC 2010
Hi Phil -
The only thing that comes to mind is the special objects array. Try
executing "Smalltalk recreateSpecialObjectsArray" to ensure it is
initialized correctly, if that doesn't help check (Smalltalk
specialObjectsArray copyFrom: 44 to: 48) which should say
#(ExternalAddress ExternalStructure ExternalData ExternalFunction
ExternalLibrary).
Cheers,
- Andreas
Phil (list) wrote:
> I'm not sure whether my problem is specific to Cuis or is more generally
> related to installing FFI. I've loaded FFI (from FFI-Kernel-ar9) by
> extracting the archive, filing in the extracted .st file, and in a
> workspace executing:
>
> (Smalltalk at: #ExternalType) initialize.
> (Smalltalk at: #ExternalStructure) compileAllFields.
>
> FFI appears to be working at least somewhat (i.e. I'm able to make basic
> OpenGL calls which are behaving as expected) but when I attempt to work
> with externally allocated memory, I'm having problems. With the
> following example:
>
> extern := ExternalAddress allocate: 12.
>
> I observe the following behavior:
> 1) Do it executes without error
> 2) Most things that attempt to look at the result (i.e. print it) crash
> the image
> 3) extern class returns CompiledMethod
> 4) Accessing it with what should be valid indexes using byteAt: and
> byteAt:put: either result in an invalid index error or crashes the image.
>
> The VM I'm using is 4.2.2 on OS X and I'm not able to reproduce the
> behavior in any of my non-Cuis images and am curious if there's an
> installation/configuration step I've missed re: FFI or if there is a bug
> specific to Cuis that might be causing this issue?
>
> Thanks,
> Phil
>
>
More information about the Squeak-dev
mailing list
|