forked from numba/llvmlite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdylib.cpp
More file actions
28 lines (23 loc) · 704 Bytes
/
Copy pathdylib.cpp
File metadata and controls
28 lines (23 loc) · 704 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "core.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/DynamicLibrary.h"
extern "C" {
API_EXPORT(void *)
LLVMPY_SearchAddressOfSymbol(const char *name) {
return llvm::sys::DynamicLibrary::SearchForAddressOfSymbol(name);
}
API_EXPORT(void)
LLVMPY_AddSymbol(const char *name, void *addr) {
llvm::sys::DynamicLibrary::AddSymbol(name, addr);
}
API_EXPORT(bool)
LLVMPY_LoadLibraryPermanently(const char *filename, const char **OutError) {
std::string error;
bool failed =
llvm::sys::DynamicLibrary::LoadLibraryPermanently(filename, &error);
if (failed) {
*OutError = LLVMPY_CreateString(error.c_str());
}
return failed;
}
} // end extern "C"