xsim does not find my plugin's plugin_create function.

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
IgorLopez
Member++
Posts: 25
Joined: Tue Mar 11, 2014 8:16 pm

xsim does not find my plugin's plugin_create function.

Post by IgorLopez »

Hi

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.
~/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)
Translation of the last sentence is:
Segmentation fault (memorydump created)
But the plugin code does have the plugin_create function.

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));
  ....
}
so I guess it is something went wrong when building the lib.

Checking the content of the lib gives
~/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*)
The whole plugin code is in the previous post Simulator (xsim) can't load plugin

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);
Now back to resolving why my I2C client does not work.


Post Reply