Hi everyone,

    I started learning ruby and I'm trying to use it from one of my C++
application. My problem is related to the garbage collection. I have a
reference to a ruby object in one of my C++ class:


class MyObject
{
private:
  VALUE m_rubyObject;
}

The problem is that ruby doesn't know about that reference, so the object
pointed by m_rubyObject is eligible for garbage collection (MyObject
instance is the only one to reference it). MyObject doesn't correspond to
any object in ruby and I don't control it's life cycle, so I can not use
Data_Wrap_Structure.

What I'm looking for is a way to register a 'mark' callback similar to the
one passed to Data_Wrap_Structure, an unregister it at a later time. That
way, I would be able to register the callback when MyObject is instantiated,
and unregister the same callback when the instance of MyObject is destroyed.

Baptiste.
---
Baptiste Lepilleur <gaiacrtn / free.fr>
http://gaiacrtn.free.fr/