GNOME Bugzilla – Bug 350870
Extend gmmproc documentation
Last modified: 2018-05-22 12:07:34 UTC
Some things are not documented in the "Wrapping a C library" documentation but are really often needed: What to do * with functions that take a Callback as argument * with functions that take an array pointer as argument (e.g GtkActionEntry *entries) * with functions that have a ... argument (Don't Panik) * with GInterfaces Some infos about type conversion would also be needed: const gchar* -> const Glib::ustring& GtkWidget* -> Gtk::Widget& ...
Some other things that could be documented: * The proper way to wrap a C function that can take a NULL. - Given foo( Type1* a, Type2* b ) , called as foo( &bar, NULL ) - Normal wrapping: Bar::foo( const Glib::RefPtr<Type2>& b ), to me, means wrapping again as: Bar::foo() ; Do we do this with _WRAP_METHOD, or a hand coded method? * Along with const gchar* -> const Glib::ustring& - GList -> Glib::ListHandle ( or do we do this with a hand-coded method? * How do we tell which _CLASS_* macro to use? A decision tree would be nice. * Proper use of the _CONSTRUCT macro * A comprehensive list of macros in API format would also be nice.
I've added an example of the use of _CONSTRUCT(), along with a section for the constructor and _WRAP_CREATE() macros.
> with functions that take a Callback as argument If a) The callback would only be used for the lifetime of that function call, just destroy it yourself afterwards. For instance *_foreach(). If b) The callback would be called only once, destroy it at the end of the callback. If c) the callback would be called several times after the function has returned, destroy it in the destroy_func callback. If there is no destroy_func parameter, file a bug. For instance *_cell_data_func().
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtkmm/issues/2.