Callbacks from C into Squeak

John M McIntosh johnmci at smalltalkconsulting.com
Fri Dec 15 18:26:05 UTC 2006


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

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.

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


On Dec 15, 2006, at 2:12 AM, Daniel Poon wrote:

> John M McIntosh <johnmci <at> smalltalkconsulting.com> writes:
>
>> Well you can't callback from C to Squeak, once you are in a primitive
>> call the interpeter is suspended, triggering a GC event requires
>> special care to ensure object pointers you many have will still be
>> valid (remapped) after the GC completes.  You can of course do a
>> limited set of VM calls to manipulate or make new object, but that
>> does not include running byte codes.  Likely this can be overcome by
>> $ (euros preferred).
>
> Thanks for the answer John.
> If I communicate with the DLL with primitive date allocated on the  
> C heap, then
> I don't mind if Squeak objects move around anymore. Am I still  
> prevented from
> calling back into Squeak?
>
>> Other options include running a VM (or VMs) as a sub process and
>> talking to it via pipes or shared memory areas for it to do
>> computational work.  Technially this is done by mac carbon and unix
>> VM when they run headless to provide support as a browser plugin.
>
> How do you get UI events into Squeak without callbacks?
>
> Cheers
>
> Daniel
>
>

--
======================================================================== 
===
John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
======================================================================== 
===





More information about the Squeak-dev mailing list