c++ - How to Make a Module Based Program With Intelligent Linking -
first off, clear confusion, 'module based program intelligent linking' mean having adapter class intelligently inherit individual header files through 'plug-n-play' type system. system needs consist of simple folder called example 'modules', , all user needs activate module drag , drop header , source file of module folder. believe need utilize scripting language generate required text, such #include
s, in adapter file. not know dynamic link libraries, prefer use them if possible (they need produce same effect of course).
for example, lets have main here:
moduleadapter->initialize(); while (true) { moduleadapter->update(); moduleadapter->render(); } moduleadapter->release();
this loop should able pass update , render function calls all of linked modules.
next, example empty module file called 'module0.h', have this:
class module0 { public: void initialize(); void update(); void render(); void release(); }
i targeting windows, multi platform great. said, scripting language work on @ least windows, osx, , unix perfect.
what need , don't understand how this; can make/do 'adapter' manages modules , processes input , output, , kind of script make , use this. assuming need script manually edit files write in #include
s , such.
thank in advance.
you use interface ( pure virtual common parent class), pimpl idiom hide implementation , dynamically loaded factory function instantiate module dll.
there won't need of headers, main program uses modules known interface via polymorphism.
the non cross-platform thing loading dll , calling dynamically loaded factory function.
check cross-platform c++ dynamic library plugin loader cross platform solutions.
Comments
Post a Comment