Kanzi Connect  3.9.8
Kanzi Connect C++ API
kanzi::connect::DynamicModule Class Reference

Class responsible of loading modules dynamically from shared libraries. More...

#include <module_loader.hpp>

Static Public Member Functions

static Module * loadModule (const string modulename, uint32_t majorVersion, uint32_t minorVersion)
 Loads and constructs a module from specific file. More...
 
static vector< string > lookupModules ()
 Searches for module from the current working directory. More...
 
static string serviceNameFromModuleFilename (string moduleFilename)
 Tries to resolve service name from module filename. More...
 
static bool unloadModule (const string modulename)
 Unloads a module . More...
 

Detailed Description

Class responsible of loading modules dynamically from shared libraries.

Member Function Documentation

◆ loadModule()

static Module* kanzi::connect::DynamicModule::loadModule ( const string  modulename,
uint32_t  majorVersion,
uint32_t  minorVersion 
)
static

Loads and constructs a module from specific file.

Parameters
modulenamethe name of the module from which the library filename is build upon.
majorVersionmajor version of kanzi loading the service.
minorVersionminor version of kanzi loading the service.
Returns
newly allocated module instance or nullptr in case loading failed. NOTE: It is not possible to unload modules so everything loaded remains in memory.

◆ lookupModules()

static vector<string> kanzi::connect::DynamicModule::lookupModules ( )
static

Searches for module from the current working directory.

Returns
vector of filenames pointing to potential modules.

◆ serviceNameFromModuleFilename()

static string kanzi::connect::DynamicModule::serviceNameFromModuleFilename ( string  moduleFilename)
static

Tries to resolve service name from module filename.

This function expects the naming to be following "service_cluster_GL_vs2015_Debug.dll" | "libservice_cluster.so"

Parameters
moduleFilenamethe module filename to be analyzed.
Returns
service name if able to resolve it. empty string if unable to do the task.

◆ unloadModule()

static bool kanzi::connect::DynamicModule::unloadModule ( const string  modulename)
static

Unloads a module .

Parameters
modulenamethe name of the module from which the library filename is build upon. return true if moulde is unloaded, otherwise false.

The documentation for this class was generated from the following file: