summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Windows/DynamicLibrary.inc
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/Windows/DynamicLibrary.inc')
-rw-r--r--llvm/lib/Support/Windows/DynamicLibrary.inc12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Support/Windows/DynamicLibrary.inc b/llvm/lib/Support/Windows/DynamicLibrary.inc
index b22c5ee7e42..a0d1d0536d3 100644
--- a/llvm/lib/Support/Windows/DynamicLibrary.inc
+++ b/llvm/lib/Support/Windows/DynamicLibrary.inc
@@ -92,6 +92,18 @@ DynamicLibrary DynamicLibrary::getPermanentLibrary(const char *filename,
return DynamicLibrary(a_handle);
}
+DynamicLibrary DynamicLibrary::addPermanentLibrary(void *handle,
+ std::string *errMsg) {
+ SmartScopedLock<true> lock(*SymbolsMutex);
+ // If we've already loaded this library, tell the caller.
+ if (!OpenedHandles->insert(handle).second) {
+ MakeErrMsg(errMsg, "Library already loaded");
+ return DynamicLibrary();
+ }
+
+ return DynamicLibrary(handle);
+}
+
// Stack probing routines are in the support library (e.g. libgcc), but we don't
// have dynamic linking on windows. Provide a hook.
#define EXPLICIT_SYMBOL(SYM) \
OpenPOWER on IntegriCloud