[llvm] r194139 - [llvm-c] Expose LLVMLoadLibraryPermanently

Peter Zotov whitequark at whitequark.org
Wed Nov 6 01:21:31 PST 2013


Author: whitequark
Date: Wed Nov  6 03:21:31 2013
New Revision: 194139

URL: http://llvm.org/viewvc/llvm-project?rev=194139&view=rev
Log:
[llvm-c] Expose LLVMLoadLibraryPermanently

Original patch by Chris Wailes

Added:
    llvm/trunk/include/llvm-c/Support.h
Modified:
    llvm/trunk/lib/Support/DynamicLibrary.cpp

Added: llvm/trunk/include/llvm-c/Support.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Support.h?rev=194139&view=auto
==============================================================================
--- llvm/trunk/include/llvm-c/Support.h (added)
+++ llvm/trunk/include/llvm-c/Support.h Wed Nov  6 03:21:31 2013
@@ -0,0 +1,36 @@
+/*===-- llvm-c/Support.h - Support C Interface --------------------*- C -*-===*\
+|*                                                                            *|
+|*                     The LLVM Compiler Infrastructure                       *|
+|*                                                                            *|
+|* This file is distributed under the University of Illinois Open Source      *|
+|* License. See LICENSE.TXT for details.                                      *|
+|*                                                                            *|
+|*===----------------------------------------------------------------------===*|
+|*                                                                            *|
+|* This file defines the C interface to the LLVM support library.             *|
+|*                                                                            *|
+\*===----------------------------------------------------------------------===*/
+
+#ifndef LLVM_C_SUPPORT_H
+#define LLVM_C_SUPPORT_H
+
+#include "llvm-c/Core.h"
+#include "llvm/Support/DynamicLibrary.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * This function permanently loads the dynamic library at the given path.
+ * It is safe to call this function multiple times for the same library.
+ *
+ * @see sys::DynamicLibrary::LoadLibraryPermanently()
+  */
+LLVMBool LLVMLoadLibraryPermanently(const char* Filename);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file

Modified: llvm/trunk/lib/Support/DynamicLibrary.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/DynamicLibrary.cpp?rev=194139&r1=194138&r2=194139&view=diff
==============================================================================
--- llvm/trunk/lib/Support/DynamicLibrary.cpp (original)
+++ llvm/trunk/lib/Support/DynamicLibrary.cpp Wed Nov  6 03:21:31 2013
@@ -19,6 +19,7 @@
 #include "llvm/ADT/StringMap.h"
 #include "llvm/Config/config.h"
 #include "llvm/Support/Mutex.h"
+#include "llvm-c/Core.h"
 #include <cstdio>
 #include <cstring>
 
@@ -169,3 +170,11 @@ void* DynamicLibrary::SearchForAddressOf
 }
 
 #endif // LLVM_ON_WIN32
+
+//===----------------------------------------------------------------------===//
+// C API.
+//===----------------------------------------------------------------------===//
+
+LLVMBool LLVMLoadLibraryPermanently(const char* Filename) {
+  return sys::DynamicLibrary::LoadLibraryPermanently(Filename);
+}
\ No newline at end of file





More information about the llvm-commits mailing list