summaryrefslogtreecommitdiffstats
path: root/ctl-lib
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2019-04-29 10:05:46 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2019-04-30 12:11:48 +0000
commitbaaa5116b2299b2b01b9fa3199ba95786c2d8a77 (patch)
treeb8be3b6ba4a7b32763a447088bd93183d701a7f3 /ctl-lib
parent32246004633b69c427af3d08b6cdee350cb95fa8 (diff)
Inject binding v3 root api into controller plugins
Inject v3 api root into the controller plugins to be able to use the weak pointer to the v3 binding root. Bug-AGL: SPEC-2369 Change-Id: Icbad4ccda3d27882e6ceaac4d0a2b43d41540c7d Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'ctl-lib')
-rw-r--r--ctl-lib/ctl-plugin.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ctl-lib/ctl-plugin.c b/ctl-lib/ctl-plugin.c
index 6839a01..1732197 100644
--- a/ctl-lib/ctl-plugin.c
+++ b/ctl-lib/ctl-plugin.c
@@ -105,9 +105,12 @@ static int PluginLoadCOne(afb_api_t apiHandle, const char *pluginpath, json_obje
// store dlopen handle to enable onload action at exec time
ctlPlugin->dlHandle = dlHandle;
- // Jose hack to make verbosity visible from sharelib with API-V2
- struct afb_binding_data_v2 *afbHidenData = dlsym(dlHandle, "afbBindingV2data");
- if (afbHidenData) *afbHidenData = afbBindingV2data;
+ // Plugins using the binder are weakly link the symbol "afbBindingV3root" that is used as the
+ // default API handle for any afb_api_... operation. To allow the plugins to use default API
+ // features (verbosity LOG by example), this is needed to supply a correct value for the plugin.
+ // The default API is a good default choice.
+ afb_api_t *afbHidenData = dlsym(dlHandle, "afbBindingV3root");
+ if (afbHidenData) *afbHidenData = afbBindingV3root;
// Push lua2cWrapper @ into plugin
Lua2cWrapperT *lua2cInPlug = dlsym(dlHandle, "Lua2cWrap");