On 6/8/04 10:42 AM, "Sean O'Dell" <sean / celsoft.com> wrote:

> On Tuesday 08 June 2004 07:37, nobu.nokada / softhome.net wrote:
>> Hi,
>> 
>> At Tue, 8 Jun 2004 23:32:28 +0900,
>> 
>> Sean O'Dell wrote in [ruby-talk:102779]:
>>> I have the docs.  What's wrong is, in an instance method, I can't seem to
>>> access the class variable from the C API.  In Ruby, instance methods can
>>> see the instance variables just fine, so I know that part of my code is
>>> working with them right.
>> 
>>   VALUE cvar = rb_cvar_get(CLASS_OF(obj), rb_intern("@@cvar"));
> 
> What I'm doing is setting the class variables in the class definition, then
> trying to use them in an instance method.  In Ruby, the instance methods can
> see the class variables just fine.  In C, the API says they don't exist.
> 
> Sean O'Dell
> 
> 

If you are in an instance method in C you get the obj as the first param.
The code above references the CLASS_OF your obj and gets its class variable
@@whatever.  Isn't that what you want?