[llvm-commits] CVS: llvm/lib/System/Win32/DynamicLibrary.inc

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



Changes in directory llvm/lib/System/Win32:

DynamicLibrary.inc updated: 1.13 -> 1.14
---
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:  (+6 -0)

 DynamicLibrary.inc |    6 ++++++
 1 files changed, 6 insertions(+)


Index: llvm/lib/System/Win32/DynamicLibrary.inc
diff -u llvm/lib/System/Win32/DynamicLibrary.inc:1.13 llvm/lib/System/Win32/DynamicLibrary.inc:1.14
--- llvm/lib/System/Win32/DynamicLibrary.inc:1.13	Sun Jan 29 16:02:52 2006
+++ llvm/lib/System/Win32/DynamicLibrary.inc	Sun Jan 29 22:33:51 2006
@@ -107,6 +107,12 @@
 }
 
 void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) {
+  // First check symbols added via AddSymbol().
+  std::map<std::string, void *>::iterator I = g_symbols.find(symbolName);
+  if (I != g_symbols.end())
+    return I->second;
+
+  // Now search the libraries.
   for (std::vector<HMODULE>::iterator I = OpenedHandles.begin(),
        E = OpenedHandles.end(); I != E; ++I) {
     FARPROC ptr = GetProcAddress((HMODULE)*I, symbolName);






More information about the llvm-commits mailing list