From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Marc Singer Newsgroups: gmane.lisp.guile.user Subject: Re: Passing lambda bindings to C for use as callback Date: Mon, 25 Nov 2002 19:22:23 -0800 Sender: guile-user-admin@gnu.org Message-ID: <20021126032223.GB24594@buici.com> References: <20021126024544.GA24594@buici.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1038281665 5676 80.91.224.249 (26 Nov 2002 03:34:25 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 26 Nov 2002 03:34:25 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18GWK0-00015D-00 for ; Tue, 26 Nov 2002 04:23:36 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 18GWJT-0005Mk-00; Mon, 25 Nov 2002 22:23:03 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 18GWIt-00053p-00 for guile-user@gnu.org; Mon, 25 Nov 2002 22:22:27 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 18GWIr-00053d-00 for guile-user@gnu.org; Mon, 25 Nov 2002 22:22:26 -0500 Original-Received: from florence.buici.com ([206.124.142.26]) by monty-python.gnu.org with smtp (Exim 4.10) id 18GWIq-00053Z-00 for guile-user@gnu.org; Mon, 25 Nov 2002 22:22:25 -0500 Original-Received: (qmail 29257 invoked by uid 1000); 26 Nov 2002 03:22:23 -0000 Original-To: guile-user@gnu.org Content-Disposition: inline In-Reply-To: <20021126024544.GA24594@buici.com> User-Agent: Mutt/1.4i Errors-To: guile-user-admin@gnu.org X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.user:1381 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:1381 On Mon, Nov 25, 2002 at 06:45:45PM -0800, Marc Singer wrote: > ...works for a while and then the gh_apply fails stating that the > callback function is missing. My guess is that this callback, an > anonymous lambda binding, is being garbage collected. > > I've found a reference to this problem and some solution being made > for tcl. Will someone share with me either the solution or a place to > find it? I found the answer by browsing an old CVS archive of the guile code. Turned out to be quite easy. 1) On startup, I register a hook using scm_c_hook_add () for scm_before_sweep_c_hook. 2) I store SCMs for active callbacks in one datastructure 3) When the hook procedure executes, it calls scm_gc_mark on each of the callback SCMs. Cake. _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://mail.gnu.org/mailman/listinfo/guile-user