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?


Miroslav Silovic <silovic@zesoi.fer.hr> a écrit :

> Dimitri Ara <dimitri.ara@mail.dotcom.fr> writes:
> 
> > init_hook = scm_make_named_hook ("init", 1);
> > 
> > and i add a function to it:
> > 
> > (add-hook! init
> >  	   (lambda (str)
> > 	     (display
> > 	      (string-append "Welcome to " str ".\n"))))
> > 
> > and then, when i run the hook, guile yalles at me:
> > 
> > ERROR: In procedure string-append:
> > ERROR: Wrong type argument: #<freed cell 0x401946b8; GC missed a reference>
> 
> It's documented... somewhere. :)

Hehe. The chapter about GC is empty in the guile reference. By
the way, are there other documentations interesting than those which
are on guile cvs? Or maybe sources of some programs?

> GC will scan the variables on the C
> stack but static and global ones. What you want to do is to call
> scm_gc_protect(init_hook) after you create it.

Hum, I didn't found any function named scm_gc_protect. I tried with
other function like scm_gc_mark ou scm_object_protect but it doesn't
work.

-- 
  Il est horrible de penser que le cerveau de certains pose un problème.
  Il me paraît plus charitable de supposer qu'il n'en ont pas.
  -+- JL in: Guide du Cabaliste Usenet - Le neurone de la Cabale -+-

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