G_DEFINE_DYNAMIC_TYPE should not make register_type static
Submitted by Patrik Olsson
Link to original bug (#614752)
Description
G_DEFINE_DYNAMIC_TYPE makes the register_type function static, which makes no sense at all. It cannot be called by the loading library. It cannot either be called by some "module_init" function because that will usually be in another compilation unit. The current workaround I have is to define a non-static "type_register" (notice reverse word order) which simply proxies the function.
I suggest the static declaration is removed. Furthermore I suggest it is instead declared with G_MODULE_EXPORT so that it can be dynamically loaded.
static void gtk_gadget_register_type (GTypeModule *type_module)
should be:
G_MODULE_EXPORT void gtk_gadget_register_type (GTypeModule *type_module)
Another thing. I don't see why it doesn't return the GType. That would be useful for the caller to get (to check if the call succeeded and also perhaps use it with g_object_new). Perhaps something to change too?
Version: 2.34.x