Callbacks in Squeak

Conrad Pöpke conrad.poepke at student.hpi.uni-potsdam.de
Sat Dec 15 14:06:28 UTC 2007


Hi Alexandre,

got no answer until now, I was hoping that Andreas Raab would answer. I 
send Andreas a copy, maybe he answers ;-)

I googled a little bit about callbacks and Squeak and found these links:
http://www.nabble.com/Callbacks%2C-simplified.-tf3294768.html#a9165431 - 
synchron callbacks
http://www.nabble.com/Updated-callbacks-tf3294849.html#a9165690
http://www.nabble.com/Callbacks-%28sigh-%3A-%29-tf1076074.html#a2801345 
- someone used asynchron callbacks
http://www.nabble.com/FFI-Callbacks-tf2200056.html#a6090814 - discussion 
about the implementation of callbacks and a short description of how to 
implement them

It seems that some people built in callbacks with semaphores, but I have 
no clue how they do it.

http://lists.squeakfoundation.org/pipermail/vm-dev/2006-June/000748.html 
- Andreas Raabe posted change sets for the vm to integrate callbacks
I applied this change sets and tried to build an own vm with callback 
support. It didn't work. I think my image and the HEAD revision of the 
Squeak vm repository are to new.
Reading the dev list links, I think it is possible to integrate callback 
support in an own vm. It would be nice to see callback support in the 
default vm, I think many plugins could use it.

Best regards
Conrad

Bergel, Alexandre schrieb:
> I am also interested into this. If you got a private answer please let 
> me know.
>
> Alexandre
>
>
> On 10 Dec 2007, at 12:50, Conrad Pöpke wrote:
>
>> Hallo everyone,
>>
>> we currently try to integrate a C libary into Squeak. It uses 
>> callbacks and I tried to find some information about callbacks in 
>> Squeak. It seems, that callbacks are supported in the Squeak VM. But 
>> my problem is, that I found no examples which show me in detail how 
>> to use them.
>>
>> I only found this post from  Andrea Raab:
>> 1. Set up a pool of callback functions that are varargs based. This
>> avoids the need to generate callbacks stubs (which may be preferrable on
>> some platforms but it doesn't matter). These functions need to "put
>> away" the stack pointer for the image to use, signal an FFI semaphore
>> and callback into the interpreter.
>> 2. When the callback is picked up in the image, the image needs to call
>> a set of support functions to take the arguments correctly from the
>> stack. This would be based on some ffi spec.
>> 3. Once all the arguments are picked up, you run your callback code.
>> 4. To return, you need to call another set of support functions for
>> storing the return value and return from the callback.
>>
>> Maybe someone can help me ?
>>
>> Best regards
>> Conrad
>>
>>
>>
>





More information about the Squeak-dev mailing list