FFI / Primitive question

Joshua Gargus schwa at fastmail.us
Mon Jun 11 00:14:53 UTC 2007

Hi all,

I have a question about mixing FFI types with primitive invocations.   
For my example, let's say that I want to pass a MacRect as a  
primitive argument.  The Slang method looks like:

primitiveFrobulate: macRect
	| rectPtr |
	self primitive: 'primitiveFrobulate' parameters: #(MacRect).
	rectPtr := interpreterProxy firstIndexableField: macRect.
	self stFrobMacRect: rectPtr

The function stFrobMacRect() is hand-written C-code that looks  
something like:

void stFrobMacRect(int ptr)
	Rect* rectPtr = (Rect*) ptr;
	/* now, frobulate the rect */

This doesn't work (I don't see the expected values while  
frobulating).  What would be the right expression to write in the  
Slang code to get a pointer to the Rect to pass to stFrobMacRect()?


More information about the Squeak-dev mailing list