FFI / Primitive question

Joshua Gargus schwa at fastmail.us
Mon Jun 11 05:35:13 UTC 2007


Hi John,

Thanks for the pointers.  I had looked at the QuickTime code before,  
and checking again I still can't see any cases where primitives are  
invoked with an instance of an FFI type as an argument (this was the  
topic of my original question).

In fact, it seems like  
#primitiveSetGWorldPtrOntoSurface:width:height:rowBytes:depth:movie:  
might be intentionally avoiding passing a MacRect; it's sole sender  
first extracts the height and width from a MacRect.  This isn't  
surprising, since I now think that it's not such a bright idea to try  
to mix FFI types with primitive invocations.

You referred to "navigation services"... are you talking about the  
Sophie-MacServices package?  If so, I'll take a close look at that  
code.  The ServicesPlugin code isn't in SophieSource; should I be  
looking in the squeakvm.org svn repository, or elsewhere?

(BTW, I'm not particularly interested in MacRects, I just wanted to  
base my example on a simple FFI type that already exists in the  
image.  I don't plan to do much frobulating, either ;-)  )

Thanks again,
Josh


On Jun 10, 2007, at 9:52 PM, John M McIntosh wrote:

> If you download Sophie you'll find lots of FFI calls especially in  
> the area of navigation Services and QuickTime each of which require  
> using much more
> complex structures that Mac Rectangles.
>
> On Jun 10, 2007, at 7:43 PM, Joshua Gargus wrote:
>
>> I think that I was a bit confused.  If I now understand correctly,  
>> the second argument to #primitive:parameters: doesn't do anything  
>> special for FFI types (i.e. subclasses of ExternalObject); it is  
>> just a dynamic type test that can be applied to any type of Squeak  
>> object.
>>
>> Is it true that the slang code must explicitly handle the two  
>> cases where the 'handle' iVar of an ExternalObject refers to:
>> 	- the binary data for the object (when the handle is a ByteArray)
>> 	- a pointer to data on the C-heap (when the handle is an  
>> ExternalAddress)   ?
>> Or, is there some feature of Slang, FFI, etc. to make it easier to  
>> work with ExternalObjects?  I suspect that there isn't.
>>
>> Thanks,
>> Josh
>>
>
> --
> ====================================================================== 
> =====
> John M. McIntosh <johnmci at smalltalkconsulting.com>
> Corporate Smalltalk Consulting Ltd.  http:// 
> www.smalltalkconsulting.com
> ====================================================================== 
> =====
>
>
>




More information about the Squeak-dev mailing list