[panda-users] problems with plugin api calls

Manolis Stamatogiannakis mstamat at gmail.com
Sun Apr 19 19:19:12 EDT 2015


Ok, this looks like a bug in the way the plugin calls are implemented.

In pluginA_ext.h, the symbol used to point to the api call is defined as:
static api_call_t __api_call =
NULL;

Because the symbol is static, it will be re-defined within *every* module
that includes pluginA_ext.h.
However, in the example I described only the symbol in pluginB.cpp will be
initialized.
The symbol in pluginB_module.cpp will remain NULL.

Could someone propose some clean way around this limitation?

I quickly checked that if I change the definition in the _ext header to an
"extern" declaration and move the definition in pluginB.cpp the calls
succeed. But this is just a quick&dirty hack to verify the problem, as it
involves manually editing the _ext file.

Thanks,
Manolis







2015-04-19 15:56 GMT-07:00 Manolis Stamatogiannakis <mstamat at gmail.com>:

> I'm having problems with using the plugin api to make calls across
> plugins. Is there an implicit assumption that plugins should consist of a
> single file?
>
> Here are the steps I make:
> (1) define the function in pluginA_int_fns.h
> (2) include this header in pluginA_int.h
> (3) implement the function in pluginA.cpp
>
> (4) include generated pluginA_ext.h from pluginB.cpp
> (5) call init_pluginA_api() without problems
> (6) include generated pluginA_ext.h from pluginB_module.cpp
> (7) make the API call from within pluginB_module.cpp
>
> Everything compiles fine, but at runtime I hit the assertion error in the
> function definition in pluginA_ext.h.
> I added some printfs and __api_call is not NULL just after
> init_pluginA_api() in pluginB.cpp. However, it is NULL inside
> pluginB_module.cpp.
>
> Any ideas how could that happen? Am I missing something in the picture?
>
> Thanks,
> Manolis
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/panda-users/attachments/20150419/f0299431/attachment.htm


More information about the panda-users mailing list