Callbacks from C into Squeak

daniel poon mr.d.poon at gmail.com
Thu Dec 14 14:17:04 UTC 2006


Callbacks from C into Smalltalk

We currently use VSE (Visual Smalltalk Enterprise). If you have a C
callback into VSE, while the callback is running, it is very difficult
to debug. If the callback halts, or there is an error, you can't debug
and resume in the normal way that you can in Smalltalk. Apparently this
is something to do with VSE using the machine stack as the Smalltalk
stack.

However, one of the nice things about VSE is: if I put a halt in the
callback, will I see the entire stack, including the methods before the
initial entry into C. Also if I throw an exception in the call back
that is not caught in the callback, will it be caught further down the
stack by code running before the initial entry into C. If it a
resumable exception, I can resume as per normal.

Now, we do a lot of numerical computing, re-using all the C and Fortran
libraries that are already out there. It is common in a numerical
library to use callbacks. Say you want to integrate f(x). The
integrator is written in Fortran, and f(x) is written in Smalltalk. You
need a way for the integrator to call f(x), and you do that with a
callback. So to leverage these libraries we need an easy way to do
callbacks, and once you have a callback you need a way of debugging
these callbacks that a mathematician (rather than a comuputer
scientist) will feel comfortable with.

So my questioin is: when you callback into Squeak from C/Fortran,
can you throw and catch exceptions, halt, debug and resume execution 
of the callback in the normal Smalltalk way. Or does the fact that 
you are in a callback compromise Smalltalk's usual execution?

Cheers

Daniel 




More information about the Squeak-dev mailing list