Perfect!  Thanks for the tip.

-- Brian

E S wrote:

>>Lett Brian Palmer <brian / pocketmartiansoftware.com>
>>Aihe: rb_const_get documentation
>>
>>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.
>>    
>>
>
>The signature is
>
>VALUE  rb_const_get (VALUE klass, ID id) 
>
>so the first parameter is the class in which to search for the 
>constant (the second is a Symbol). For top-level, the class is Object 
>(or rb_cObject). For a nested class, you should look in the enclosing 
>class. So, you'd do 
>
>VALUE cGlit    = rb_const_get(rb_cObject, rb_intern("GLIT"));
>VALUE cGlitVec = rb_const_get(cGlit, rb_intern("Vec"));
>
>I think :)
> 
>  
>
>>Thanks a bundle for any help you all can provide.  I appreciate it.
>>
>>-- Brian Palmer
>>    
>>
>
>E
>
>
>
>
>
>  
>