[squeak-dev] Re: [Cuis] FFI problem with ExternalAddress

Phil (list) pbpublist at gmail.com
Tue Feb 16 19:57:28 UTC 2010

On Feb 16, 2010, at 12:16 PM, Andreas Raab wrote:

> 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


I appreciate your suggestion and it looks like that was the problem  
and solution (those items were nil prior to calling  

Thanks again,

> 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