C++ inheritance and dynamic library loading -
i'm trying create modular application in c++. works fine when linked statically, want achieve plug-in architecture (using dlopen or loadlibrary).
all base classes located in host apllication , these classes extended in plug-in modules. modules loaded @ run-time.
application module ---------------- ------------------- | baseclass1 | | extendedclass1 | | baseclass2 | | extendedclass2 | | baseclass3 | | extendedclass3 | ---------------- -------------------
but when try compile module, linker can't find references baseclass methods.
can somehow tell linker not link these classes @ compile time , let os link them on load in run-time? or should use different approach , move baseclasses core library , link both application , module core library?
just said, use core approach. create common/core directory, has header files of baseclass1 baseclass3. when compile host application, have access common directory. when compile plug-in, have access common directory.
if need release host binary external customers, include common directory, external customer can program own plug-in. how it. not best solution, works.
Comments
Post a Comment