From: ts Date: 2006-03-26T23:54:00+09:00 Subject: Re: Saving Proc object in C extension >>>>> "V" == Victor Shepelev writes: V> static VALUE save_callback(VALUE self, VALUE proc) V> { V> ...bla-bla-bla... V> rb_global_variable(&proc); //as recommended in "Extending Ruby" proc is on the stack, after the end of save_callback() &proc don't make reference to the proc object. V> What I do wrong? This is g_callback which must be registered. static VALUE g_callback; static VALUE save_callback(VALUE self, VALUE proc) { /* ... */ g_callback = proc; /* ... */ } /* ... */ void Init_bla_bla_bla() { /* ... */ g_callback = Qnil; rb_global_variable(&g_callback); /* ... */ } Guy Decoux