I have a situation where I need to hold a reference to a Ruby object (instance of VALUE) SOLELY from a C struct; i.e., the Ruby object is created and passed to the C library.
Currently, the Ruby object stays valid so long as, somewhere in my Ruby app, something else also reference the object. But as soon as the only reference to the object is held by the C struct, garbage collection reaps it since mark-and-sweep no longer can find it.
I need a way to keep such objects alive; i.e., I want them to live until such a time as either the C struct is released or else the object's reference is removed.