Matz, I can give you my wrapper code but I'm afraid it's too big (116 Ko)... :-) In fact, after seeing the output result of swig wrapper, I decide not to override the new and initialize ruby function (as written in the pickaxe too) and just called Data_Wrap_Struct() after all ruby init of an instance, in a foo_create() function. The main constraint of that is : the cpp part of the object ( my cpp class) is not newed before the call of the ruby function create()... this work fine from 1.6.6 to 1.6.8 version. in 1.8.0, it's seems that if I not put the Data_Wrap_Struct() before the initialize() function call, the gc from the gc_sweep() function line 939, call obj_free() that call my cpp destructor function cb_destroy_foo() on some still alive objects . ?! Internal flags on these objects (as.basic.flags) are FL_MARK less. I will try to extract this problem in a small sample , but it's not obvious. Anyway putting Data_Wrap_Struct() in the foo_new() seems to work quite fine. >I can't see the intention of the code. Is rb_foo a subclass of >Class? Otherwise, you must not pass self to Data_Wrap_Struct(). rb_foo = rb_define_class("Foo", rb_cObject); the first arg of Data_Wrap_Struct() should be the class ref ? no ?