unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Marc Singer <elf@buici.com>
Subject: Re: Passing lambda bindings to C for use as callback
Date: Mon, 25 Nov 2002 19:22:23 -0800	[thread overview]
Message-ID: <20021126032223.GB24594@buici.com> (raw)
In-Reply-To: <20021126024544.GA24594@buici.com>

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


  reply	other threads:[~2002-11-26  3:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-26  2:45 Passing lambda bindings to C for use as callback Marc Singer
2002-11-26  3:22 ` Marc Singer [this message]
2002-11-26 12:10   ` Marius Vollmer
2002-11-26 20:55     ` Marc Singer
2002-11-26 21:56       ` Thien-Thi Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021126032223.GB24594@buici.com \
    --to=elf@buici.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).