I am starting a new topic (old one is Simulator (xsim) can't load plugin)
The new problem is that xsim does not see the plugin_create function.
Translation of the last sentence is:~/xmosworkspace/i2cTest/bin$ xsim i2cTest.xe --plugin I2CTestPlugin.so '0 XOD23 XOD13'
ERROR: plugin 'I2CTestPlugin.so' does not have a 'plugin_create' function
Segmenteringsfel (minnesutskrift skapad)
But the plugin code does have the plugin_create function.Segmentation fault (memorydump created)
Code: Select all
XsiStatus plugin_create(void **instance, XsiCallbacks *xsi, const char *arguments)
{
if (s_num_instances >= MAX_INSTANCES) {
fprintf(stderr, "ERROR: too many instances of plugin (max %d)\n", MAX_INSTANCES);
return XSI_STATUS_INVALID_INSTANCE;
}
assert(CHECK_INTERFACE_VERSION(xsi));
....
}
Checking the content of the lib gives
The whole plugin code is in the previous post Simulator (xsim) can't load plugin~/xmosworkspace/i2cTest/bin$ nm -C --defined-only -g ../../../Tools/XMOS/xTIMEcomposer/Community_14.0.3/lib/I2CTestPlugin.so
0000000000202084 B __bss_start
0000000000202084 D _edata
0000000000202168 B _end
0000000000000e80 T _fini
00000000000007f8 T _init
0000000000000bd0 T plugin_clock(void*)
0000000000000a90 T plugin_create(void**, XsiCallbacks*, char const*)
0000000000000e60 T plugin_notify(void*, int, unsigned int, unsigned int)
0000000000000e70 T plugin_terminate(void*)
Updated. To make a long story short, I was trying with a testbench to load my plugin (dlopen, dlsym) and after trying many different combinations I finally found the problem.
Code: Select all
// This declaration in the header file does not work when building the library:
DLL_EXPORT XsiStatus plugin_create(void **instance, XsiCallbacks *xsi, const char *arguments);
// It has to be replaced by:
extern "C" XsiStatus plugin_create(void **instance, XsiCallbacks *xsi, const char *arguments);