Accessing a class pointer and class methods



These is a GObject questions, really.

How do I call a class method on some GObject-based type?

How do I even *implement* such a method?

I suppose a fair enough answer to the first question, if this is a type
I'm developing, is to export the method as a function.

But in that function, how do I get a pointer to the class? If I had a
pointer to an instance, I could use G_TYPE_INSTANCE_GET_CLASS; but this
is a *class* method.

The kludge I've been avoiding is to add a static variable to the class
implementation, and have that variable set to the class pointer during
the class initialization. But surely there's a better way?

Thanks!
Gaal

PS: I don't generally need the pointer outside the class implementation,
of course, unless that's the way to call class methods.

-- 
Gaal Yahas <gaal forum2 org>
http://gaal.livejournal.com/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]