46#if defined(__linux__) || defined(__APPLE__)
71#if defined(__linux__) || defined(__APPLE__)
78 virtual bool Init(
const char *libName)
noexcept {
79 if (handle)
return true;
80#if defined(__linux__) || defined(__APPLE__)
81 handle = dlopen(libName, RTLD_NOW);
83 if (handle ==
nullptr) {
84 const char *dlsym_error = dlerror();
85 if (!mute && dlsym_error)
86 std::cerr <<
"Library: Unable to load library, error: " << dlsym_error
92 handle = LoadLibraryA(libName);
93 if (handle ==
nullptr) {
94 const DWORD error = GetLastError();
96 std::cerr <<
"Library: Unable to load library, error code: " << error
106#if defined(__linux__) || defined(__APPLE__)
107 return dlsym(handle, funcName);
109 return GetProcAddress(handle, funcName);
113 const void *
GetHandle() const noexcept {
return handle; }
115 bool IsMuted() const noexcept {
return mute; }
120#if defined(__linux__) || defined(__APPLE__)
121 void *handle =
nullptr;
123 HINSTANCE handle =
nullptr;
void * GetFunction(const char *funcName) noexcept
const void * GetHandle() const noexcept
Library(const Library &)=delete
void SetMute(bool m) noexcept
virtual bool Init(const char *libName) noexcept
Library(Library &&)=delete
Library & operator=(Library &&)=delete
Library & operator=(const Library &)=delete
bool IsMuted() const noexcept