From: Simon Strandgaard <0bz63fz3m1qt3001@...> Date: 2003-04-25T06:34:24+09:00 Subject: Re: Accessing Ruby class from C extention On Thu, 24 Apr 2003 19:29:39 +0000, Phil Tomson wrote: > In article <006b01c30a8e$5b24ad70$6401a8c0@MELONBALLER>, > Chris Pine wrote: >>Maybe I'm not understanding, but can't you just call `new' on the class you >>want to instantiate? >> > I want to call 'new' on the class on the C side. The more I think about > it, the more I doubt this is possible. Its possible, I do it myself all the time. char *name_of_class = "test"; VALUE klass = rb_const_get(rb_cObject, rb_intern(name_of_class)); // (a) //VALUE self = rb_class_new_instance(n, argv, klass); // (b) VALUE self = rb_funcall2(klass, rb_intern("new"), n, argv); As you can see there is two ways to instantiate (a) or (b). -- Simon Strandgaard