How to use my own GObject instace with C++ programs
i would like to know how i can use my own created GObject objects with my c++ code.
I have a simple libary compiled in C that define a GObject object, i would like to use this object defined there in my c++ code.
I have seen some example here http://developer.gnome.org/gtkmm-tutorial/3.0/sec-basics-gobj-and-wrap.html.en, where the documentation teaches how t开发者_运维知识库o get a Gobject object instace from a C GTK+ API function.
I would like to do the same but using the object created from my libary.
Thanks.
You can always extend their GObject class and use that as a wrapper but the thing is that the GTK+ library uses the GObject internally I don't know why you would want to replace it (and it might complain that you've redefined a symbol somewhere or won't let you call any methods using your custom object as a parameter as the types won't match if you do extend it).
If you want to use it as a wrapper you should extend GObject and write a constructor that takes the GObject (and any other things that you need) and simply wrap the GObject into your custom class every time it's required.
精彩评论