----- Original Message ----- 
From: "Gennady" <gfb / tonesoft.com>
To: "ruby-talk ML" <ruby-talk / ruby-lang.org>
Sent: Thursday, April 24, 2003 3:34 PM
Subject: Re: Accessing Ruby class from C extention


>
> ----- Original Message ----- 
> From: "Phil Tomson" <ptkwt / shell1.aracnet.com>
> Newsgroups: comp.lang.ruby
> To: "ruby-talk ML" <ruby-talk / ruby-lang.org>
> 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.

I mean, as a receiver for "new".

>
> >
> > At any rate, rb_eval_string is working fine for me.
> >
> > Phil
> >
> >
>
> Gennady.
>
>
>