AW: [cffi-devel] Re: unnamed callback (closures?)

Hoehle, Joerg-Cyril Joerg-Cyril.Hoehle at t-systems.com
Tue Feb 7 16:23:13 UTC 2006


Jan Rychter wrote:
>   The problem is that the C side insists on identifying
>   callbacks to delete by a function pointer. In this approach all
>   callbacks would get the same function pointer on the C side -- that
>   of the dispatching callback function on the Lisp side. Which means I
>   won't be able to delete them on the C side afterwards.

Then just don't delete them. If the C side only sees only one, there won't be such a memory loss (but analyse that, maybe there's some for each new window?).
OTOH, as Martin Simmons said, other GUI (which one are you using?) don't suffer from such a braindamage. And more importantly, named callbacks are supported by all Lisps (?), whereas lambdas only work with sbcl + clisp.

>2. I was actually wrong when I said I knew when the callback 
>would be no
>   longer needed. Not quite sure what to do about this yet. I know next
>   to nothing about finalizers -- can I expect them to be supported?
Forget about finalizers.  *YOU* are the only one to be able to tell when the other side has finished using a resource.

A good time to free resource is generally when the application exists...

Regards,
	Jörg Höhle.



More information about the cffi-devel mailing list