argos::CDynamicLoading Class Reference

Allows users to dynamically load shared libraries. More...

#include <dynamic_loading.h>

Public Types

typedef void * TDLHandle
 The handle to a loaded library. More...
 

Static Public Member Functions

static TDLHandle LoadLibrary (const std::string &str_lib)
 Loads a dynamic library. More...
 
static void UnloadLibrary (const std::string &str_lib)
 Unloads a dynamic library. More...
 
static void LoadAllLibraries ()
 Loads all the dynamic libraries in the current ARGOS_PLUGIN_PATH. More...
 
static void UnloadAllLibraries ()
 Unloads all the dynamic libraries. More...
 

Detailed Description

Allows users to dynamically load shared libraries.

Definition at line 24 of file dynamic_loading.h.

Member Typedef Documentation

The handle to a loaded library.

Definition at line 31 of file dynamic_loading.h.

Member Function Documentation

void argos::CDynamicLoading::LoadAllLibraries ( )
static

Loads all the dynamic libraries in the current ARGOS_PLUGIN_PATH.

Internally used to execute queries (argos3 –query).

Exceptions
CARGoSExceptionin case of error

Definition at line 183 of file dynamic_loading.cpp.

CDynamicLoading::TDLHandle argos::CDynamicLoading::LoadLibrary ( const std::string &  str_lib)
static

Loads a dynamic library.

This method tries to load the library pointed to by the specified path.

If the given path is absolute, this method tries to load the library pointed to by the specified path. If loading fails, it tries another time appending the extension for shared libraries (e.g., .so on Linux, .dylib on Mac) to the path. If also this attempt fails, this method tries appending the extension for module libraries (e.g., .so on Linux and Mac). If all attempts fail, the method raises an exception.

If the given path is relative, this method forms absolute paths prepending the given path with the directories of the default loading path (e.g., /usr/lib/argos3), the contents of ARGOS_PLUGIN_PATH, and the current working directory. For each absolute path so formed, the method attempts to load the library in the same way as described above (e.g., appending the extension of shared/module libraries if needed).

Parameters
str_libThe path of the dynamic library to load
Returns
A handle to the loaded dynamic library
Exceptions
CARGoSExceptionin case of error

Definition at line 66 of file dynamic_loading.cpp.

void argos::CDynamicLoading::UnloadAllLibraries ( )
static

Unloads all the dynamic libraries.

Exceptions
CARGoSExceptionin case of error

Definition at line 250 of file dynamic_loading.cpp.

void argos::CDynamicLoading::UnloadLibrary ( const std::string &  str_lib)
static

Unloads a dynamic library.

Parameters
str_libThe path of the dynamic library to unload
Exceptions
CARGoSExceptionin case of error

Definition at line 161 of file dynamic_loading.cpp.