Callbacks from C into Squeak

David T. Lewis lewis at mail.msen.com
Sun Dec 17 17:50:09 UTC 2006


On Sun, Dec 17, 2006 at 04:56:45PM +0000, daniel poon wrote:
> David T. Lewis <lewis <at> mail.msen.com> writes:
> > Bert is referring to an OS process (unix, win32), not a Smalltalk
> > process. So the plugin could fork an OS process and communicate with
> > it through any of several mechanisms.  But his suggestion of a toolkit
> > that does not require callbacks is really the first thing that you
> > should consider.
> 
> Thanks for your clarification and your code snippets. 
> I was using the GUI callback as an illustration of a callback, but what I am
> really interested in is calling back from foreign mathematical libraries, and
> how to do that in Squeak. We have had some success in doing such things in
> another Smalltalk dialect, and I want to know if I can port that work on to 
> Squeak. 
> 
> Will using separate processes perform well enough? To simulate a few seconds
> using a physics simulation, a maths library would have to make about a million
> callbacks into Smalltalk. You would want the simulation to take seconds or
> minutes rather than hours. 

My guess is that separate processes would *not* perform well enough, but my
guessing does not count for much. If you have a fairly good idea of how many
callbacks are happening, it might be worth putting together a no-op test
to find out how fast it runs. You could for example run a million transactions
with Squeak sending "hello there" (and flushing the stream), and a C program
echoing the message back but otherwise doing nothing. The results will
probably be disappointing, but you never know.

Dave




More information about the Squeak-dev mailing list