help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] dynamically creating a callback function


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] dynamically creating a callback function
Date: Wed, 22 Nov 2006 10:18:46 +0100
User-agent: Thunderbird 1.5.0.8 (Macintosh/20061025)

Krishna wrote:
On 11/22/06, Brad Watson <address@hidden> wrote:
Does anyone have an idea on how a callback function mapped to a class and selector could be created dynamically ? Lots of libraries that Ive examined have functions defined within them that require a callback function as one of the parameters. It would be useful to be able define the callback function in smalltalk and then pass an address that maps it's way back to it.. Possible ?

Checkout ffcall and libffi . Both offer the facility to build runtime
trampolines. IIRC, CLISP uses ffcall.

If it is possiblle to pass an arbitrary pointer to the callback, you can use that to store the selector and receiver. Then you use it to call back into Smalltalk.

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]