Callbacks from C into Squeak

daniel poon mr.d.poon at gmail.com
Sat Dec 16 18:14:05 UTC 2006


John M McIntosh <johnmci <at> smalltalkconsulting.com> writes:

> As Andreas pointed out there is work to support callbacks and I  
> discovered I'm missing a 1/2 day of messages from june that talked  
> about this feature.
> 
> http://lists.squeakfoundation.org/pipermail/vm-dev/2006-June/000748.html 

I did see Andreas' post, but tweaking the VM is a bit new to me, so I couldn't
respond to it. 

> A subprocess or something can communicate with the Smalltalk VM by  
> signaling a semaphore, or if you have a custom VM by sticking some  
> event of your choosing on the event queue , look at the sqInputEvent  
> structure in sq.h.  These events are read by the VM in class  
> EventSensor. I'll not there is no interface to place events on the VM  
> queue which is why you must build a custom VM for that support.

Using callbacks to stick events onto the Smalltalk VM's event queue - this
sounds the same as what VSE does with most of its Windows events. However it is
only applicable if the event does not require an answer from the callback (e.g.
'the user has hit a button'). 

If it is a callback that requires an answer (e.g. 'give me the contents for this
list box'), what do  you do?

> Although normally one signals a semaphore that a smalltalk process is  
> waiting on. You can allocate storage externally from the smalltalk  
> memory space using the fixed memory allocators in FFI to provide  
> shared memory for a subprocess to communicate with the smalltalk code

The FFI sounds all good, and the code in the FFI looks much like stuff in VSE.

Cheers

Daniel




More information about the Squeak-dev mailing list