diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-02-16 07:07:15 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-02-16 07:07:15 (GMT) |
commit | 635640a32fecbb9b8a5ddf239b819c022c4b9977 (patch) | |
tree | f8fc69a2c2db411000996146536ca5cc4f54d417 /src/plugins/plugin.c | |
parent | bf879f2562545ab7de23f9d38364b7bd4b43fb2c (diff) |
Added a basic support for Mobicore truslets.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@472 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
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); |