rb_const_get documentation

B

Brian Palmer

What's the best place to find out more about the rb_const_get family of
functions for writing C extensions? I'm writing my first C library for
Ruby, and struggling with how to get VALUEs for Classes and Modules
provided by Ruby and other extensions. The Pickaxe 2.0 has a wonderful
section on C extensions, for the most part, but it seems to omit mention
of rb_const_get completely. Took me an hour of searching the ml to even
discover its existence.

A few pressing questions:
(1) What does the rb_cObject parameter that I'm always passing in do?
What other things might I pass in for this argument?
(2) How do I get a handle to a Class that's inside a module? I tried
calling (for example) rb_const_get(rc_cObject, rb_intern("GLIT::Vec"))
but I get an error. However, calling GLIT::Vec.new from a ruby script
that's using the C extension works fine, so I must have the syntax wrong.

Thanks a bundle for any help you all can provide. I appreciate it.

-- Brian Palmer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,164
Messages
2,570,898
Members
47,440
Latest member
YoungBorel

Latest Threads

Top