------ art_19297_16915159.1145309106803 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline THANK YOU!!!!!! You have saved me from probably a good week's worth of hell (aka C++). I spent a lot of time building up my abstractions in RubyCLR so that all of the nasty marshaling / interop goo generation stuff was handled in Ruby. Without your solution, I would have had to re-implement about half of those abstractions in raw C++, which probably would have taken me at least another week to implement. Let me know if we're ever in the same city - I definitely owe you dinner for this one :) Cheers, -John http://www.iunknown.com On 4/15/06, ts <decoux / moulon.inra.fr> wrote: > > >>>>> "J" == John Lam <drjflam / gmail.com> writes: > > J> def eval_it(obj, &b) > J> obj.instance_eval(&b) > J> end > > moulon% cat a.c > #include <ruby.h> > > static VALUE > a_eval_it(VALUE obj, VALUE a) > { > return rb_obj_instance_eval(0, 0, a); > } > > void Init_a() > { > VALUE a_cA = rb_define_class("A", rb_cObject); > rb_define_method(a_cA, "eval_it", a_eval_it, 1); > } > moulon% > > moulon% ruby -ra -e 'b = Object.new; A.new.eval_it(b) {p self; @b = 12}; p > b' > #<Object:0xb7d5ec8c> > #<Object:0xb7d5ec8c @b=12> > moulon% > > > Guy Decoux > > ------ art_19297_16915159.1145309106803--