9 #define WIN32_LEAN_AND_MEAN
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)
26 void *LoadLib(const char *name)
29 void *handle{dlopen(name, RTLD_NOW)};
30 const char *err{dlerror()};
31 if(err) handle = nullptr;
34 void CloseLib(void *handle)
36 void *GetSymbol(void *handle, const char *name)
39 void *sym{dlsym(handle, name)};
40 const char *err{dlerror()};
41 if(err) sym = nullptr;