summaryrefslogtreecommitdiffstats
path: root/ctl-lib/ctl-plugin.c
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-09-11 11:09:15 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-09-24 11:24:37 +0000
commite37c3a81d88c0fe51a854d51d01a52554b8d67ce (patch)
tree74f570f0e45325ffb57c91abc401a0c45f716f08 /ctl-lib/ctl-plugin.c
parentdcf433f90bc5fbcd42709a1d1a04c8c20c115807 (diff)
The onload step could be considered as a preinit step. Init stage happens once all plugins are loaded and so you can refer to them to add new actions or configuration elements. Change-Id: I7986265bb1227208d0648bb2c56a1172b164faf1 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'ctl-lib/ctl-plugin.c')
-rw-r--r--ctl-lib/ctl-plugin.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/ctl-lib/ctl-plugin.c b/ctl-lib/ctl-plugin.c
index d27b71d..3dfecd9 100644
--- a/ctl-lib/ctl-plugin.c
+++ b/ctl-lib/ctl-plugin.c
@@ -438,8 +438,17 @@ int PluginConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *pluginsJ
{
// Jose hack to make verbosity visible from sharedlib and
// be able to call verb from others api inside the binder
- struct afb_binding_data_v2 *afbHidenData = dlsym(ctlPlugins[idx++].dlHandle, "afbBindingV2data");
+ struct afb_binding_data_v2 *afbHidenData = dlsym(ctlPlugins[idx].dlHandle, "afbBindingV2data");
if (afbHidenData) *afbHidenData = afbBindingV2data;
+
+ DispatchPluginInstallCbT ctlPluginInit = dlsym(ctlPlugins[idx].dlHandle, "CtlPluginInit");
+ if (ctlPluginInit) {
+ if((*ctlPluginInit) (&ctlPlugins[idx], ctlPlugins[idx].context)) {
+ AFB_ApiError(apiHandle, "Plugin Init function hasn't finish well. Abort initialization");
+ return -1;
+ }
+ }
+ idx++;
}
return 0;
}