![]() |
RobWorkProject
23.9.11-
|
Loader for dynamic/shared libraries. More...
#include <DynamicLibraryLoader.hpp>
Inherits DynamicLibraryLoaderBase.
Public Member Functions | |
DynamicLibraryLoader (const std::string &filename, const std::string &funcname="factory0") | |
Constructs loader and opens the library. More... | |
virtual | ~DynamicLibraryLoader () |
Closes the handle to the library. More... | |
T * | get () |
Returns object loaded from library. More... | |
![]() | |
DynamicLibraryLoaderBase (const std::string &filename) | |
Open the library. More... | |
virtual | ~DynamicLibraryLoaderBase () |
Closes the handle to the library. | |
void * | getObject (const std::string &funcname) |
Returns pointer to object loaded using the factory function funcname. More... | |
virtual std::string | getFileExtension () const |
Returns file extension of dynamic libraries on the current platform. More... | |
Loader for dynamic/shared libraries.
The DynamicLibraryLoader provides a template based interface to the DynamicLibraryLoaderBase.
Notice that when using the dynamicLibraryLoader it is necessary to link with additional libraries. On Linux/Mac link with "dl". On Windows link with "kernel32".
|
inline |
Constructs loader and opens the library.
When constructed the DynamicLibraryLoader open the library and throws an exception on failure. The search for the funcname entry is not done until trying to obtain the actual object.
filename | [in] Library file name (with extension) |
funcname | [in] Name of factory function in the library (default: factory0) |
|
inlinevirtual |
Closes the handle to the library.
|
inline |
Returns object loaded from library.
Calls the factory method in library and returns the object. This method throws an exception if the factory method cannot be found.