Comment #4 on issue 130 by
stanisla...@smartcom.bg: Init hook and client
cookie issues
http://code.google.com/p/klish/issues/detail?id=130
Hi, Serj,
Yes, I am sure, I saw it experimentally on FreeBSD at least (I can try
Linux as well, if needed).
The issue is that the plugin is linked to libclish.so itself, so what
happens is that when dlsym doesn't find the symbol it's looking for in the
shared object (let's call it 'x') whose handle you've passed it, it
continues to search through the shared objects that 'x' is linked with and
finds it in libclish.so :-)
I'm attaching a .tgz with a Makefile, a .c file and 2 XML files (actually
they're the files from xml_examples/test with a simple modification to
startup.xml to reference the plugin).
If you add a printf to CLISH_PLUGIN_INIT in clish/builtin/builtin_init.c
such as "printf("%s called\n", __func__);" and do the tests below you'll be
able to see what I am talking about...
When you build the plugin with "make rebuild KLISH_LIB=-lclish" -> you'll
see "clish_plugin_init called" twice.
When you build the plugin with "make rebuild" -> you'll
see "clish_plugin_init called" only once.
I'll think a little more about how this can be solved.
Best wishes,
Stanislav
Attachments:
clish_test_hook.tgz 1.1 KB