49 virtual bool Init(
const char *libName)
noexcept {
51 handle = dlopen(libName, RTLD_NOW);
53 if (handle ==
nullptr) {
54 const char *dlsym_error = dlerror();
55 if (!mute && dlsym_error)
56 std::cout <<
"Library: Unable to load library, error: " << dlsym_error
62 handle = LoadLibraryA(libName);
63 if (handle ==
nullptr) {
64 const DWORD error = GetLastError();
66 std::cout <<
"Library: Unable to load library, error code: " << error
77 return dlsym(handle, funcName);
79 return GetProcAddress(handle, funcName);
83 const void *
GetHandle() const noexcept {
return handle; }
85 bool IsMuted() const noexcept {
return mute; }
87 void SetMute(
bool m)
noexcept { mute = m; }
91 void *handle =
nullptr;
93 HINSTANCE handle =
nullptr;
void * GetFunction(const char *funcName) noexcept
Library(Library &&)=default
const void * GetHandle() const noexcept
Library(const Library &)=delete
void SetMute(bool m) noexcept
virtual bool Init(const char *libName) noexcept
Library & operator=(const Library &)=delete
bool IsMuted() const noexcept
Library & operator=(Library &&)=default