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

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

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

<p>FTR, as <a href="https://github.com/codebrainz" class="user-mention">@codebrainz</a> already mentioned somewhere, note that GModule has <a href="https://developer.gnome.org/glib/unstable/glib-Dynamic-Loading-of-Modules.html#GModuleCheckInit"><code>g_module_check_init()</code></a> hook, so a plugin can already call <code>g_module_make_resident()</code> before <code>geany_load_module()</code>, even if it might look less integrated.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/geany/geany/pull/719#issuecomment-152850416">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABDrJ-LxHHWQrURrYKAEL-diGN7nu3RCks5pBlC4gaJpZM4GZg2a.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/geany/geany/pull/719#issuecomment-152850416"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>