[plt-scheme] Preventing GC on Scheme_Object

From: Vijay Mathew (vijay.the.schemer at gmail.com)
Date: Sat Feb 9 07:07:54 EST 2008

I have an extention for mzscheme in C++.

This is how my code looks like:

struct Widget
    Scheme_Object* callback;

    Widget() : callback(scheme_null) { }

Scheme_Object* callback(int argc, Scheme_Object** argv)
    Widget* w = new Widget;
    w->callback = argv[0];
    return scheme_true;

argv[0] is a procedure assigned from scheme code.
This is getting garbage collected when i call (collect-garbage) even though
a reference is held in w->callback.
I want to tell the GC about this reference.
scheme_dont_gc_ptr(argv[0]) did not help.


 -- Vijay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20080209/60279669/attachment.html>

Posted on the users mailing list.