[Ruby/C] How to get a Class instance of your class

Greetings compadres !

I’m on the verge of finishing my awesome C++ wrapper for the libruby,
which is awesome.

Yet I need a tiny last thing to ease the work of extending Ruby
generated Ruby classes with C++ generated Ruby classes.

I need to get a VALUE of a Class object describing a Ruby generated
class.
This is what I tried :

VALUE ret = rb_gv_get(“NameOfClass”);

But this returns Qnil, for some reason.
Yet I can instanciate NameOfClass via C (and via Ruby as well). What’s
up with that ^^ ?

Of course, I can get the Class instance by calling the class method on
an instance of the class I’m trying to get. But I would have to create
an instance of this class. And that’s pretty much what
I don’t wanna do.

Thanks for helping (if you decide to help. Otherwise, shame on you !)

rb_gv_get is for global variables ( this with $)

rb_const_get does not work for some reason, use the ruby func

rb_myClass =
rb_funcall(rb_cObject,rb_intern(“const_get”),1,rb_str_new2(“name”))

same for new (it exist a c method what makes a new object but i does it
find it now)

rb_funcall(rb_myClass,rb_intern(“new”), …)

i can help you later more

Hey ! It works !

Well thanks a lot bro !
Next time I’ll post, it will be to present the awesome API I’ve designed
!

ah found:

VALUE rb_class_new_instance(int argc,VALUE *argv,VALUE klass)

this makes a new instance of a class
argc is the parameter count
argv are the parameters as C-Vector
klass is the ruby class

(be carefull, it does not call the new method)