/// operating system interface, this class provides a portable interface that
/// allows dynamic libraries to be loaded and and searched for externally
/// defined symbols. This is typically used to provide "plug-in" support.
+ /// It also allows for symbols to be defined which don't live in any library,
+ /// but rather the main program itself, useful on Windows where the main
+ /// executable cannot be searched.
/// @since 1.4
/// @brief Portable dynamic library abstraction.
class DynamicLibrary {
DynamicLibrary();
/// This is the constructor for DynamicLibrary instances. It will open
- /// the dynamic library specified by the \filename Path.
+ /// the dynamic library specified by the filename Path.
/// @throws std::string indicating why the library couldn't be opened.
/// @brief Open a dynamic library.
DynamicLibrary(const char* filename);
return SearchForAddressOfSymbol(symbolName.c_str());
}
+ /// This functions permanently adds the symbol \p symbolName with the
+ /// value \p symbolValue. These symbols are searched before any
+ /// libraries.
+ /// @brief Add searchable symbol/value pair.
+ static void AddSymbol(const char* symbolName, void *symbolValue);
+
+ /// @brief Convenience function for C++ophiles.
+ static void AddSymbol(const std::string& symbolName, void *symbolValue) {
+ AddSymbol(symbolName.c_str(), symbolValue);
+ }
+
/// @}
/// @name Accessors
/// @{