This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Why does the GC frees my function?


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?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]