aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Support/DynamicLibrary.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Support/DynamicLibrary.h')
-rw-r--r--include/llvm/Support/DynamicLibrary.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/llvm/Support/DynamicLibrary.h b/include/llvm/Support/DynamicLibrary.h
index a7d22212dbdb..aa9bb8938ad3 100644
--- a/include/llvm/Support/DynamicLibrary.h
+++ b/include/llvm/Support/DynamicLibrary.h
@@ -68,6 +68,15 @@ namespace sys {
static DynamicLibrary getPermanentLibrary(const char *filename,
std::string *errMsg = nullptr);
+ /// Registers an externally loaded library. The library will be unloaded
+ /// when the program terminates.
+ ///
+ /// It is safe to call this function multiple times for the same library.
+ ///
+ /// \returns An empty \p DynamicLibrary if the library was already loaded.
+ static DynamicLibrary addPermanentLibrary(void *handle,
+ std::string *errMsg = nullptr);
+
/// This function permanently loads the dynamic library at the given path.
/// Use this instead of getPermanentLibrary() when you won't need to get
/// symbols from the library itself.