Gobject construction for bindings.



Hello. I'm trying to implement a registration system for gobjects from c++.
I know the existence of gtkmm, but it's not enough for my purposes.

So I want to know the following. I have the GTypeInfo structure, which
I have to fill so that I can use my Gobjects from c++ and have them registered
in the type system. The problem is, that I don't know how to register a C++
constructor. I know I have to do it in the GInstanceInitFunc of the
GTypeInfo, but
I cannot understand the signature very well:


void                (*GInstanceInitFunc)                (GTypeInstance
*instance,
                                                         gpointer g_class);

So if I have a Car class:

class Car : public glib::object {
 Car(int val);
};

I want to call my c++ constructor when g_type_new() is invoked, so I try:

extern "C" {

void                carInit (GTypeInstance *instance,
                                                         gpointer g_class)
{
  //What should I do here to be able to call my c++ constructor???????????????
}

}


I don't know how to access my instance to call the c++ constructor,
because I don't
understand very well the parameters.

Can anyone help? Thanks in advance.


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