46#if defined(__linux__) || defined(__APPLE__)
71#if defined(__linux__) || defined(__APPLE__)
78 virtual bool Init(
const char *libName)
noexcept {
79#if defined(__linux__) || defined(__APPLE__)
80 handle = dlopen(libName, RTLD_NOW);
82 if (handle ==
nullptr) {
83 const char *dlsym_error = dlerror();
84 if (!mute && dlsym_error)
85 std::cerr <<
"Library: Unable to load library, error: " << dlsym_error
91 handle = LoadLibraryA(libName);
92 if (handle ==
nullptr) {
93 const DWORD error = GetLastError();
95 std::cerr <<
"Library: Unable to load library, error code: " << error
105#if defined(__linux__) || defined(__APPLE__)
106 return dlsym(handle, funcName);
108 return GetProcAddress(handle, funcName);
112 const void *
GetHandle() const noexcept {
return handle; }
114 bool IsMuted() const noexcept {
return mute; }
119#if defined(__linux__) || defined(__APPLE__)
120 void *handle =
nullptr;
122 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