[llvm-commits] CVS: llvm/include/llvm/System/DynamicLibrary.h

Jeff Cohen jeffc at jolt-lang.org
Sun Jan 29 20:34:04 PST 2006



Changes in directory llvm/include/llvm/System:

DynamicLibrary.h updated: 1.4 -> 1.5
---
Log message:

Add AddSymbol() method to DynamicLibrary to work around Windows limitation
of being unable to search for symbols in an EXE.  It will also allow other
existing hacks to be improved.


---
Diffs of the changes:  (+14 -0)

 DynamicLibrary.h |   14 ++++++++++++++
 1 files changed, 14 insertions(+)


Index: llvm/include/llvm/System/DynamicLibrary.h
diff -u llvm/include/llvm/System/DynamicLibrary.h:1.4 llvm/include/llvm/System/DynamicLibrary.h:1.5
--- llvm/include/llvm/System/DynamicLibrary.h:1.4	Thu Apr 21 15:48:15 2005
+++ llvm/include/llvm/System/DynamicLibrary.h	Sun Jan 29 22:33:51 2006
@@ -26,6 +26,9 @@
   /// 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 {
@@ -81,6 +84,17 @@
         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
     /// @{






More information about the llvm-commits mailing list