linker - C++ unresolved reference between plugins -
i have application plugins (loading using dlopen), worked until now, when faced problem cannot solve on own.
there plugins. one, lets say, contains class - makerclass. second plugin, (indirectly, using "host" application calls) called function in plugin one. second plugin should @ data , write result makerclass. there problem - when function in second plugin calls (makerclass*)mc->writenumber(12345), i've got unresolved symbol error.
in code lang, looks (simplified):
host app:
hostapp::callplugin(void * data) { this->second->foo(data); }
plugin one, main.cpp, compiled main.o , linked maker.o main.so
#include "maker.h" //here defined makerclass .... void somefunction() { makerclass mc; mc.dosomeinitialization(); this->host->callplugin(&mc); }
plugin second, main.cpp:
#include "maker.h" secondplugin::foo(void * data) { makerclass * mc = (makerclass*)data; mc->writedata(1234); // raise problem - while dlopen (if rtld_now) or when called (if rtld_lazy used) }
it should solution use rtld_global, every plugin have init. methods same name, makes problem, when rtld_now used , plugin second loaded before one.
so... exists clean solution? much!
the solution virtual functions, abstract interfaces, idl , other such things >:-)
Comments
Post a Comment