MCPcopy Create free account
hub / github.com/AdaptiveCpp/AdaptiveCpp / load_plugin

Function load_plugin

src/runtime/backend_loader.cpp:33–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31
32using namespace hipsycl::common;
33bool load_plugin(const std::string &filename, void *&handle_out,
34 std::string &backend_name_out) {
35 std::string message = "";
36 if (void *handle = load_library(filename, message)) {
37 if (void *symbol = get_symbol_from_library(
38 handle, "hipsycl_backend_plugin_get_name", message)) {
39 auto get_name =
40 reinterpret_cast<decltype(&hipsycl_backend_plugin_get_name)>(symbol);
41
42 handle_out = handle;
43 backend_name_out = get_name();
44
45 return true;
46 } else {
47 if (!message.empty()) {
48 HIPSYCL_DEBUG_WARNING << "[backend_loader] " << message << std::endl;
49 message = "";
50 }
51 close_library(handle, message);
52 if (!message.empty()) {
53 HIPSYCL_DEBUG_ERROR << "[backend_loader] " << message << std::endl;
54 }
55 return false;
56 }
57 } else {
58 if (!message.empty()) {
59 HIPSYCL_DEBUG_WARNING << "[backend_loader] " << message << std::endl;
60 }
61 return false;
62 }
63}
64
65hipsycl::rt::backend *create_backend(void *plugin_handle) {
66 assert(plugin_handle);

Callers 1

query_backendsMethod · 0.85

Calls 4

load_libraryFunction · 0.85
get_symbol_from_libraryFunction · 0.85
close_libraryFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected