From baaa5116b2299b2b01b9fa3199ba95786c2d8a77 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Mon, 29 Apr 2019 10:05:46 +0200 Subject: 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 --- ctl-lib/ctl-plugin.c | 9 ++++++--- 1 file 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"); -- cgit 1.2.3-korg