chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] SWIG and callbacks


From: felix winkelmann
Subject: Re: [Chicken-users] SWIG and callbacks
Date: Sun, 4 Mar 2007 13:47:22 +0100

On 3/3/07, Tony Sidaway <address@hidden> wrote:
I'm trying to write a callback in Scheme.  The unusual thing about
this callback is that it's intended to be invoked during the course of
a Swig call.

I know that our native FFI has foreign-lambda and foreign-safe-lambda,
the latter intended for this kind of circumstance.  My question is:
does Chicken Swig also permit this, or would I have to rewrite the
swig code to make it safe for callbacks?

Examining the Scheme code for "create-foreign-stub", which generates
all foreign calls in the Chicken ffi, it seems that what needs to be
done before a "safe"  or what was formerly known as a "callback" call,
boils down to the following:

* make 24 bytes more space for the result type
* perform a minor garbage collection.

I suppose I could add these to my swig-generated stubs and see what
happens, but I thought I'd ask first in case somebody knows.


You also have to save the callback-continuation (see "generate-foreign-stubs"
in c-backend.scm). For the swig-specific information, you should contact
John Lenz (who wrote the swig backend).


cheers,
felix




reply via email to

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