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

Colomban Wendling notifications at xxxxx
Sat Nov 14 18:20:55 UTC 2015


> I would just deprecate it and recommend g_module_check_init() universally 

But then it's tricky to only make the module resident in `init()`.  Well, tricky meaning storing the module pointer and using it later, like if it was a `geany_load_module()` parameter.

```c
static GModule *module_self = NULL;

G_MODULE_EXPORT
const gchar* g_module_check_init(GModule *module)
{
  module_self = module;
  return NULL;
}

static gboolean myplugin_init(GeanyPlugin *plugin, gpointer data)
{
  g_module_make_resident(module_self);
  
  return TRUE;
}

G_MODULE_EXPORT
void geany_load_moule(GeanyPlugin *plugin)
{
  /* ... */
  plugin->funcs->init = myplugin_init;
  /* ... */
  GEANY_PLUGIN_REGISTER(plugin, 234);
}

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


More information about the Github-comments mailing list