GNOME Bugzilla – Bug 555294
Support multiple libraries per module
Last modified: 2015-02-07 16:59:50 UTC
So that we can have additions/overrides implemented in a separate lib.
Created attachment 120056 [details] [review] First tentative patch
A bit of context here. The point here is to abstract symbol lookup in typelib in g_typelib_symbol so that we transparently perform the lookup in several modules. Consequently, this implements a sort of fallback mechanism: if the symbol is not found in any of loaded modules, we look for the symbol in the global module (always added to the end of the list of modules).
I like the direction of this patch in general. Comments: * When we support multiple modules, the find_some_symbol approach to determine whether the library is already loaded becomes fragile. One thought is to add an attribute like loaded_symbol="clutter_init" or something to the GIR and typelib - but that seems ugly. Or maybe we pick the first symbol we see when compiling a typelib. * The typelib init function is getting hairy...not really this patch's fault but something to look at, wouldn't consider a blocker though * Could use an update to docs/typelib-format.txt * Missing spaces in a few places like: + typelib->modules = g_list_append(typelib->modules, app_module);
Created attachment 120165 [details] [review] Update patch Here's the updated patch: - Loads all libs unconditionally - Always loads global module as the last fallback option - Fixes coding style here and there
Comment on attachment 120165 [details] [review] Update patch Looks good. Could possibly use a small comment linking to this bug (or something) above the loop for all the g_module_opens.
(In reply to comment #5) > (From update of attachment 120165 [details] [review] [edit]) > Looks good. Could possibly use a small comment linking to this bug (or > something) above the loop for all the g_module_opens. Ok, done. Thanks! 2008-10-06 Lucas Rocha <lucasr@gnome.org> Bug 555294: Add support for multiple shared libraries per typelib. * girepository/ginvoke.c (g_function_info_invoke), girepository/ginfo.c(g_registered_type_info_get_g_type): use g_typelib_symbol instead of g_module_symbol. * girepository/girepository.h: remove g_typelib_set_module and add g_typelib_symbol. * girepository/gtypelib.[ch] (find_some_symbol, _g_typelib_init, g_typelib_new_from_memory, g_typelib_new_from_const_memory, g_typelib_free, g_typelib_symbol): chnage GTypeLib to hold a list of modules instead of just one. The symbol lookup is now abstracted behind g_typelib_symbol which tries to find the passed symbol name in one of its modules. * giscanner/girwriter.py, tools/g-ir-scanner: change scanner to read and write shared_library attribute as a comma-separated list of libs.
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]