Warn when resampled HRIR delays get clamped
[openal-soft.git] / common / dynload.cpp
blobf1c2a7ebb9a8baf9a1beed119649d97b491963f4
2 #include "config.h"
4 #include "dynload.h"
6 #include "strutils.h"
8 #ifdef _WIN32
9 #define WIN32_LEAN_AND_MEAN
10 #include <windows.h>
12 void *LoadLib(const char *name)
14 std::wstring wname{utf8_to_wstr(name)};
15 return LoadLibraryW(wname.c_str());
17 void CloseLib(void *handle)
18 { FreeLibrary(static_cast<HMODULE>(handle)); }
19 void *GetSymbol(void *handle, const char *name)
20 { return reinterpret_cast<void*>(GetProcAddress(static_cast<HMODULE>(handle), name)); }
22 #elif defined(HAVE_DLFCN_H)
24 #include <dlfcn.h>
26 void *LoadLib(const char *name)
28 dlerror();
29 void *handle{dlopen(name, RTLD_NOW)};
30 const char *err{dlerror()};
31 if(err) handle = nullptr;
32 return handle;
34 void CloseLib(void *handle)
35 { dlclose(handle); }
36 void *GetSymbol(void *handle, const char *name)
38 dlerror();
39 void *sym{dlsym(handle, name)};
40 const char *err{dlerror()};
41 if(err) sym = nullptr;
42 return sym;
44 #endif