After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 555294 - Support multiple libraries per module
Support multiple libraries per module
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2008-10-06 21:13 UTC by Lucas Rocha
Modified: 2015-02-07 16:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
First tentative patch (15.00 KB, patch)
2008-10-06 21:14 UTC, Lucas Rocha
none Details | Review
Update patch (15.71 KB, patch)
2008-10-07 21:02 UTC, Lucas Rocha
committed Details | Review

Description Lucas Rocha 2008-10-06 21:13:22 UTC
So that we can have additions/overrides implemented in a separate lib.
Comment 1 Lucas Rocha 2008-10-06 21:14:37 UTC
Created attachment 120056 [details] [review]
First tentative patch
Comment 2 Lucas Rocha 2008-10-06 21:25:03 UTC
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).
Comment 3 Colin Walters 2008-10-06 21:30:54 UTC
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);

Comment 4 Lucas Rocha 2008-10-07 21:02:34 UTC
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 5 Colin Walters 2008-10-07 21:07:51 UTC
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.
Comment 6 Lucas Rocha 2008-10-07 21:25:13 UTC
(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.
Comment 7 André Klapper 2015-02-07 16:59:50 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]