LLVM 23.0.0git
DylibManager.h
Go to the documentation of this file.
1//===------ DylibManager.h - Manage dylibs in the executor ------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// APIs for managing real (non-JIT) dylibs in the executing process.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_EXECUTIONENGINE_ORC_DYLIBMANAGER_H
14#define LLVM_EXECUTIONENGINE_ORC_DYLIBMANAGER_H
15
18#include "llvm/Support/Error.h"
20
21#include <future>
22
23namespace llvm::orc {
24
25class SymbolLookupSet;
26
28public:
29 virtual ~DylibManager();
30
31 /// Load the dynamic library at the given path and return a handle to it.
32 /// If LibraryPath is null this function will return the global handle for
33 /// the target process.
34 virtual Expected<tpctypes::DylibHandle> loadDylib(const char *DylibPath) = 0;
35
36 /// Search for symbols in the target process.
37 ///
38 /// The result of the lookup is an array of target addresses that correspond
39 /// to the lookup order. If a required symbol is not found then this method
40 /// will return an error. If a weakly referenced symbol is not found then it
41 /// will be assigned a '0' value.
44 std::promise<MSVCPExpected<tpctypes::LookupResult>> RP;
45 auto RF = RP.get_future();
46 lookupSymbolsAsync(H, Symbols,
47 [&RP](auto Result) { RP.set_value(std::move(Result)); });
48 return RF.get();
49 }
50
53
54 /// Search for symbols in the target process.
55 ///
56 /// The result of the lookup is an array of target addresses that correspond
57 /// to the lookup order. If a required symbol is not found then this method
58 /// will return an error. If a weakly referenced symbol is not found then it
59 /// will be assigned a '0' value.
61 const SymbolLookupSet &Symbols,
63};
64
65} // end namespace llvm::orc
66
67#endif // LLVM_EXECUTIONENGINE_ORC_DYLIBMANAGER_H
#define LLVM_ABI
Definition Compiler.h:213
#define F(x, y, z)
Definition MD5.cpp:54
#define H(x, y, z)
Definition MD5.cpp:56
Tagged union holding either a T or a Error.
Definition Error.h:485
Expected< tpctypes::LookupResult > lookupSymbols(tpctypes::DylibHandle H, const SymbolLookupSet &Symbols)
Search for symbols in the target process.
unique_function< void(Expected< tpctypes::LookupResult >)> SymbolLookupCompleteFn
virtual Expected< tpctypes::DylibHandle > loadDylib(const char *DylibPath)=0
Load the dynamic library at the given path and return a handle to it.
virtual void lookupSymbolsAsync(tpctypes::DylibHandle H, const SymbolLookupSet &Symbols, SymbolLookupCompleteFn F)=0
Search for symbols in the target process.
A set of symbols to look up, each associated with a SymbolLookupFlags value.
Definition Core.h:199
unique_function is a type-erasing functor similar to std::function.
ExecutorAddr DylibHandle
A handle used to represent a loaded dylib in the target process.