This is the mail archive of the guile@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] |
James Dean Palmer <james@tiger-marmalade.com> writes: > Hello all, > > I'm working on an fltk (a c++ widget library) binding for guile, and > for the most part it's going fairly smoothly, but I have a few > questions regarding garbage collection. Cool. > Basically, through point of example I am doing this: > > (define temp (fltk-window-new "Hello World" 200 400)) > (use-this-window-in-my-program temp) > (define temp "Blah") > > The "use-this-window-in-my-program" connects the structure in the smob > to the gui. > > But when I redefine the temp variable, that window is subject to > garbage collection. What I would like is that the window structure > and the smob associated with it persist. You can use scm_protect_object(foo) (or scm_permanent_object(foo), if you want it to live forever). There's a usage note in gc.c -- Greg