[Github-comments] [geany] plugins: pass GModule * to geany_load_module() (#719)

Colomban Wendling notifications at xxxxx
Sun Nov 1 18:26:00 UTC 2015


> Yes, it would be better to do it in `init()` for best efficiency but IMO we should allow for doing it in `geany_load_module()` too, might be necessary and/or more convenient for some plugins.

Yes, i.e. for your examples using instance methods on a (GObject) class for init/cleanup etc.

The thing is, if we remove `plugin_module_make_resident()`, it becomes very hard for a plugin to call `g_module_make_resident()` from `init()`, as it would have to save the module pointer.  This is not trivial without using a global variable, as plugins can only `set_data()` once, so this can't be used if the plugin wants to delay data allocation in `init()` (which most plugins should do).
…and I feel odd about advertizing a different function to do the very same thing just depending on whether it's called from `load_module()` or not…  other opinions? @codebrainz @elextr 

FTR, as @codebrainz already mentioned somewhere, note that GModule has [`g_module_check_init()`](https://developer.gnome.org/glib/unstable/glib-Dynamic-Loading-of-Modules.html#GModuleCheckInit) hook, so a plugin can already call `g_module_make_resident()` before `geany_load_module()`, even if it might look less integrated.

---
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/719#issuecomment-152850416
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20151101/94c21e96/attachment.html>


More information about the Github-comments mailing list