Ryan D. wrote:
Chapter 21 of the Pickaxe (2nd ed) is what you want. It covers this
topic fairly well.
I’m not exposing a Ruby object though. Also, the order in which the
objects are freed when the interpreter process exits matters: if my
world object is freed before the instances, there will be a segmentation
fault. The order in which circularly referenced objects are freed at
exit seems to be undefined, so maintaining a reference for every object
won’t work well.
As I said before, I tried something along the lines of:
world = create_world();
world_holder = Data_Wrap_Struct(rb_cObject, 0,
but still get segmentation faults.