[llvm-commits] CVS: llvm/lib/System/DynamicLibrary.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Jul 7 10:12:48 PDT 2006
Changes in directory llvm/lib/System:
DynamicLibrary.cpp updated: 1.14 -> 1.15
---
Log message:
Change LoadLibraryPermanently to not throw an exception.
---
Diffs of the changes: (+13 -7)
DynamicLibrary.cpp | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
Index: llvm/lib/System/DynamicLibrary.cpp
diff -u llvm/lib/System/DynamicLibrary.cpp:1.14 llvm/lib/System/DynamicLibrary.cpp:1.15
--- llvm/lib/System/DynamicLibrary.cpp:1.14 Sun May 14 14:00:53 2006
+++ llvm/lib/System/DynamicLibrary.cpp Fri Jul 7 12:12:36 2006
@@ -18,7 +18,8 @@
// Collection of symbol name/value pairs to be searched prior to any libraries.
static std::map<std::string, void *> g_symbols;
-void llvm::sys::DynamicLibrary::AddSymbol(const char* symbolName, void *symbolValue) {
+void llvm::sys::DynamicLibrary::AddSymbol(const char* symbolName,
+ void *symbolValue) {
g_symbols[symbolName] = symbolValue;
}
@@ -99,20 +100,25 @@
}
}
-void DynamicLibrary::LoadLibraryPermanently(const char* filename) {
+bool DynamicLibrary::LoadLibraryPermanently(const char *Filename,
+ std::string *ErrMsg) {
check_ltdl_initialization();
- lt_dlhandle a_handle = lt_dlopen(filename);
+ lt_dlhandle a_handle = lt_dlopen(Filename);
if (a_handle == 0)
- a_handle = lt_dlopenext(filename);
+ a_handle = lt_dlopenext(Filename);
- if (a_handle == 0)
- throw std::string("Can't open :") +
- (filename ? filename : "<current process>") + ": " + lt_dlerror();
+ if (a_handle == 0) {
+ if (ErrMsg)
+ *ErrMsg = std::string("Can't open :") +
+ (Filename ? Filename : "<current process>") + ": " + lt_dlerror();
+ return true;
+ }
lt_dlmakeresident(a_handle);
OpenedHandles.push_back(a_handle);
+ return false;
}
void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) {
More information about the llvm-commits
mailing list