JeVois Smart Embedded Machine Vision Toolkit
Class to open shared object (.so) files and load functions contained in them.
This class allows one to open a shared library (.so file) and to invoke functions or classes that are in that library.
Engine uses DynamicLoader to load the appropriate vision processing Module each time the user selects a new VideoMapping (i.e., changes image resolution in a USB webcam program running on a host computer, or invokes the
setmapping command over Serial port).
This class is modified from DynamicLoader in the Neuromorphic Robotics Toolkit (NRT).
|DynamicLoader (std::string const &filename, bool closeOnDestroy)|
|Open the shared object located at filename, throws if fail. More...|
|std::string const &||sopath () const|
|Retrieve the path to the .so file of this loader, useful to avoid closing and re-loading the same .so file. More...|
|Destructor, may close the object on destroy (see constructor arguments) More...|
|Close the shared object file. More...|
|template<class Signature >|
|std::function< Signature >||load (std::string const &functionName)|
|Load the symbol named functionName. More...|
Open the shared object located at filename, throws if fail.
If closeOnDestroy is true, the .so file will be closed when the DynamicLoader object is destroyed. If you want to maintain access to the functions and classes in a .so file after the loader has run out of scope, set closeOnDestroy to false (and you will then have no way of ever unloading that .so file until termination of your program).
Close the shared object file.
Beware that closing the object file will remove all links to any objects/functions/etc that have been created from the shared object. Use this function only if you want nothing more to do with anything created from this object file.
Load the symbol named functionName.
This method returns an std::function that points to the requested name in the shared object opened by this DynamicLoader. For example, to load the function
int foo(double x, bool y) from the file "mySharedObject.so" you should write:
Throws if the requested symbol could not be found in the opened shared object.
|std::string const & jevois::DynamicLoader::sopath||(||)||const|