57 [[nodiscard, gnu::always_inline]]
inline auto open_plugin(
const char* path)
59 auto handle = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
63 throw std::runtime_error{dlerror()};
79 template<
typename Sig>
84 ptr =
reinterpret_cast<Sig
>(dlsym(handle, name));
86 throw std::runtime_error{dlerror()};
101 if(handle ==
nullptr)
104 auto err = dlclose(handle);
107 auto errstr = dlerror();
108 if(errstr !=
nullptr)
109 std::fprintf(stderr,
"WARNING: Error while closing plugin library: %s\n", errstr);
111 std::fprintf(stderr,
"WARNING: Unknown error while closing plugin library.\n");