From: ts Date: 2001-06-23T17:22:10+09:00 Subject: [ruby-talk:16793] Re: wrapping structures >>>>> "M" == Martin Chase writes: M> anyway, here's a piece of my c coding that should (hopefully) show where M> i'm having the problem. nothing in it will really be important except M> the "Data_(Wrap|Get)_Struct" parts and what they deal with, as the rest M> i have verified as functional with non-ruby-extending test programs that M> use the same fuctions (but i left it in to help describe the setting): Well it's difficult to say but why all these indirections ??? M> VALUE LP_dict_new(VALUE class, VALUE dict_names) M> { M> VALUE rb_dict; M> VALUE argv[1]; M> Dictionary *LP_dict; ^^^^^^^^^^^^^^^^^^^ M> *LP_dict = dictionary_create( ^^^^^^^^ M> STR2CSTR(rb_ary_shift(dict_names)), M> STR2CSTR(rb_ary_shift(dict_names)), M> STR2CSTR(rb_ary_shift(dict_names)), M> STR2CSTR(rb_ary_shift(dict_names))); M> argv[0] = rb_dict = Data_Wrap_Struct(class, 0, LP_dict_delete, LP_dict); M> rb_obj_call_init(rb_dict, 1, argv); M> return rb_dict; M> } why you don't write Dictionary LP_dict = dictionary_create(/* ... */); Guy Decoux