X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FSystem%2FDynamicLibrary.h;h=f90126c7360bdcc096a68c9c5ae088cfbd83c558;hb=393830a33a02d2f7163fcd4b27b7e5d6a46d8bac;hp=5edbfd6f22f7d76adc363c9d37a12393caa8fdab;hpb=63b3afa98460ce38a1c48d3c44ef6edfdaf37b77;p=oota-llvm.git diff --git a/include/llvm/System/DynamicLibrary.h b/include/llvm/System/DynamicLibrary.h index 5edbfd6f22f..f90126c7360 100644 --- a/include/llvm/System/DynamicLibrary.h +++ b/include/llvm/System/DynamicLibrary.h @@ -26,6 +26,9 @@ namespace sys { /// 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 { @@ -42,7 +45,7 @@ namespace sys { 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); @@ -81,6 +84,17 @@ namespace sys { 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 /// @{