This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Why does the GC frees my function?
- To: Dimitri Ara <dimitri dot ara at mail dot dotcom dot fr>
- Subject: Re: Why does the GC frees my function?
- From: Miroslav Silovic <silovic at zesoi dot fer dot hr>
- Date: 24 Feb 2000 10:26:21 +0100
- Cc: guile at sourceware dot cygnus dot com
- References: <877lfvo5k6.fsf@toto.debian>
Dimitri Ara <dimitri.ara@mail.dotcom.fr> writes:
...
> return alpha_binding[(int) c - (int) 'a'] = function;
...
> Then I execute it but it seems that the GC frees the function. Why?
> Can I tell the gcc not to do it (without binding my function to a
> symbol)? Did i use a wrong way to do what i want to do?
GC doesn't know about alpha binding, so it can't mark SCMs pointed
from it as used. One way to make it do so is to allocate alpha binding
as a protected Scheme vector:
SCM *alpha_binding;
void init_alpha_binding
{
SCM v = scm_make_vector (SCM_MAKINUM(26), SCM_BOOL_F);
scm_protect_object (v);
alpha_binding = SCM_VELTS(v);
}
--
How to eff the ineffable?