[Geany] "plugins" for plugins

Nick Treleaven nick.treleaven at xxxxx
Mon Jan 14 13:50:21 UTC 2008


On Sun, 13 Jan 2008 22:30:51 -0600
"Jeff Pohlmeyer" <yetanothergeek at gmail.com> wrote:

[...]
> After trying just about every combination of linker flags
> (and a few impossible ones) re-compiling, re-installing,
> and re-starting, again and again, all without any luck,
> I finally stumbled upon the solution - if I remove the
> G_MODULE_BIND_LOCAL flag from g_module_open() in plugins.c,
> everything works just fine.
> 
> But it might not be a good idea to let any and all plugins
> have access to the global namespace like that, so I wonder
> if there could be some way for a plugin to request this,
> maybe something like this...
> 
> Open the plugin normally, using the G_MODULE_BIND_LOCAL
> flag, and check for the existence of some symbol, e.g.
> 
>   make_me_global=TRUE;
> 
> If that symbol is NOT found, or if it evaluates to FALSE,
> then continue on loading the plugin as always. But if the
> symbol exists and is true, then close the module and
> re-open it *without* the G_MODULE_BIND_LOCAL flag.
[...]

We needed to add it in r1734:
"Use G_MODULE_BIND_LOCAL for plugins to prevent symbol shadowing by
other modules, and to help detect unresolved symbols at loading time."

IIRC without it calling info() from within a plugin when > 1 plugins
were loaded without G_MODULE_BIND_LOCAL one of the plugins would get the
wrong plugin name.

I don't think we should allow any loading without it, because things
can silently go wrong.

Regards,
Nick



More information about the Users mailing list