From: Gennady Date: 2003-04-25T07:34:55+09:00 Subject: Re: Accessing Ruby class from C extention ----- Original Message ----- From: "Phil Tomson" Newsgroups: comp.lang.ruby To: "ruby-talk ML" Sent: Thursday, April 24, 2003 2:33 PM Subject: Re: Accessing Ruby class from C extention > > It seems like to call the constructor of a Ruby class from C that you > have to use rb_eval_string("YourRubyClass.new"); I don't see how you > could do it otherwise since rb_funcall needs a receiver and you don't yet > have a reciever: > > rb_funcall(VALUE recv, ID id, int argc, ...); > > So how would you call Foo.new using rb_funcall? You'd have to get the ID: > rb_intern("Foo.new"); > But then what would you use for recv? You can get the value of constant "Foo" (seems like rb_gv_get() will do the job, I may be mistaken) and use it as a receiver. > > At any rate, rb_eval_string is working fine for me. > > Phil > > Gennady.