diff options
Diffstat (limited to 'src/plugins/plugin.c')
-rw-r--r-- | src/plugins/plugin.c | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index fd55f8c..0ca19e4 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -222,13 +222,25 @@ GPluginModule *g_plugin_module_new(const gchar *filename) switch (category) { - case DPC_NONE: + case DPC_BASIC: switch (sub) { case DPS_NONE: break; + case PGA_PLUGIN_INIT: + if (!load_plugin_symbol(result->module, + "chrysalide_plugin_init", &result->init)) + goto bad_plugin; + break; + + case PGA_PLUGIN_EXIT: + if (!load_plugin_symbol(result->module, + "chrysalide_plugin_exit", &result->exit)) + goto bad_plugin; + break; + default: log_variadic_message(LMT_WARNING, _("Unknown sub-category '0x%02x' in plugin '%s'..."), sub, filename); @@ -269,27 +281,21 @@ GPluginModule *g_plugin_module_new(const gchar *filename) } - - - - - /* - if (!g_module_symbol(result->module, "init_plugin", (gpointer *)&result->init)) - result->init = NULL; - - if (!g_module_symbol(result->module, "exit_plugin", (gpointer *)&result->exit)) - result->exit = NULL; - */ - - - - - /* Conclusion */ dir = strdup(filename); dir = dirname(dir); + if (result->init != NULL) + { + if (!result->init(result)) + { + log_variadic_message(LMT_ERROR, + _("Plugin '%s' failed to load itself..."), filename); + goto bad_plugin; + } + } + log_variadic_message(LMT_PROCESS, _("Loaded the '<b>%s</b>' from the '<b>%s</b>' directory"), strrchr(filename, G_DIR_SEPARATOR) + 1, dir); |