Skip to content

Commit 738dc65

Browse files
committed
Add DynamicLibrary support functions
1 parent 2fdef9e commit 738dc65

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

COVERAGE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,7 @@ ORC JIT
11541154
Support
11551155
-------
11561156

1157-
- [ ] LLVMLoadLibraryPermanently
1158-
- [ ] LLVMParseCommandLineOptions
1159-
- [ ] LLVMSearchForAddressOfSymbol
1160-
- [ ] LLVMAddSymbol
1157+
- [x] LLVMLoadLibraryPermanently
1158+
- [x] LLVMParseCommandLineOptions
1159+
- [x] LLVMSearchForAddressOfSymbol
1160+
- [x] LLVMAddSymbol

src/support.jl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,26 @@ function clopts(opts...)
44
args = ["", opts...]
55
API.LLVMParseCommandLineOptions(length(args), args, C_NULL)
66
end
7+
8+
"""
9+
add_symbol(name, ptr)
10+
11+
Permanently add the symbol `name` with the value `ptr`. These symbols are searched
12+
before any libraries.
13+
"""
14+
add_symbol(name, ptr) = LLVM.API.LLVMAddSymbol(name, ptr)
15+
16+
"""
17+
load_library_permantly(path)
18+
19+
This function permanently loads the dynamic library at the given path.
20+
It is safe to call this function multiple times for the same library.
21+
"""
22+
load_library_permantly(path) = LLVM.API.LLVMLoadLibraryPermanently(path)
23+
24+
"""
25+
find_symbol(name)
26+
27+
Search the global symbols for `name` and return the pointer to it.
28+
"""
29+
find_symbol(name) = LLVM.API.LLVMSearchForAddressOfSymbol(name)

0 commit comments

Comments
 (0)