I've been using Data_Wrap_Struct in the Ruby extension lib successfully
for wrapping up C/C++ structs and classes by using something like:

static VALUE
myext_new() {
	myclass* c = new myclass;
	return Data_Wrap_Struct(cMyExt, 0, RB_FINALIZER(myext_free), c);
}

where myext_free simply deletes the object. However, now I need to wrap up
a class and save it in a variable in the object. From the docs on
Data_Wrap_Struct I figured I might try:

static void
myext2_inititalize(VALUE self) {
	myclass* c = new myclass;
	VALUE temp = Data_Wrap_Struct(rb_cObject, 0,
RB_FINALIZER(myext_free), c);
	rb_ivar_set(self, rb_intern("@low_level_obj"), temp);
}

but when I run it it hangs on the Data_Wrap_Struct line. Can anyone shed
some light on this and explain in more detail than in the README.EXT file
how the Data_X_Struct defines work/should be used?

I have tried different classes to wrap it in but it doesn't matter. What
I'm I misunderstanding here?

Thanks in advance,

Robert