You are here: My Account > Point one > Count three
Headline news
Advertisement
 

Projects / AuxUtils Cpp / Snippets

The project AuxUtils is an auxiliary C++ library that implements the missing functionality from the Boost libraries. The library provides some efficient functions and templates and wraps some platforms dependent functions.
PrevUpHomeNext

Snippet: Dynamic module usage

This snippet illustrates how to use dynamic module. Dynmod provide a support for dynamically loading shared libraries with the specific implementation based on standard API with versioning (checking API versions) and standard lifecycle methods (single init & finalization library, creating an instance of object, looking up object by class name)

The TestDynmod module should exist and ITestInstance interface should be implemented inside it.

// Load module
auxutils::dynmod::ModulesFactory* poFactory = auxutils::dynmod::ModulesFactory::getInstance();
auxutils::dynmod::IModule::SharedPtr poModule = poFactory->loadModule("TestDynmod");

// Create the object instance
boost::shared_ptr poInstance = poModule->createModuleObject();
poInstance->doIt();

// ..

// Delete object and unload module
poInstance.reset();
poFactory->unloadModule ( poModule );
PrevUpHomeNext