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
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