From: William Djaja Tjokroaminata Date: 2002-10-24T23:43:19+09:00 Subject: Re: On Using Data_Wrap_Struct Tim Hunter wrote: > ruby_bar = rb_funcall(Class_Bar, rb_intern("new"), 2, > INT2FIX(c_bar.n), rb_str_new2(c_bar.msg)); > On Thu, 24 Oct 2002 05:23:27 +0900, Mark Probert wrote: >> f = Foo.new >> f.run # --> runs and adds Bars to @arr >> f.arr.each { |bar| puts "#{bar.n} --> #{bar.msg}" } >> >> I think that I need to use Data_Wrap_Struct, however >> I am not sure. Hi Mark, It depends on what you actually want to do. With the given example code structure, the coupling is not bi-directional, i.e., when you have something like this in Ruby bar.msg = 'a new string' then the corresponding C's cbar.msg is not automatically modified. If you want automatic coupling from Ruby to C, then you need Data_Wrap_Struct. Regards, Bill