>>>>> "L" == Lenny  <kudling / kde.org> writes:

L> Now i don't know how to write a corresponding "bar=()" function. Can anybody 
L> give me a hint? iv_set_var() seems to be unnecessary inefficient.

 static VALUE 
 setBar(VALUE self, VALUE obj)
 {
     foo *p;
     Data_Get_Struct(self, foo, p);
     p->bar = obj;
     return obj;
 }

 /* ... */

 rb_define_method(Foo, "bar", getBar, 0);
 rb_define_method(Foo, "bar=", setBar, 1);


p.s. : don't forget to have a mark function for your struct and mark p->bar


Guy Decoux