From: Baptiste Lepilleur Date: 2002-04-27T20:10:10+09:00 Subject: Re: newbie: embedding ruby and garbage collection Thanks. After looking at Data_Wrap_Struct implementation, I saw that the 'mark' callback was tied with a ruby object, so I went for the global variable trick. Baptiste. ----- Original Message ----- From: "ts" To: "ruby-talk ML" Cc: Sent: Friday, April 26, 2002 5:49 PM Subject: Re: newbie: embedding ruby and garbage collection > >>>>> "B" == Baptiste Lepilleur writes: > > B> What I'm looking for is a way to register a 'mark' callback similar to the > B> one passed to Data_Wrap_Structure, an unregister it at a later time. That > B> way, I would be able to register the callback when MyObject is instantiated, > B> and unregister the same callback when the instance of MyObject is destroyed. > > Rather than register a callback, you can just create an object (with > Data_Wrap_struct) and store it in a Hash or Array (declared with > rb_global_variable()). > > When the instance of MyObject is destroyed, you just remove this object > from the hash (or the array). > > > Guy Decoux > > > > > >