mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 14:44:36 +00:00
update openal-soft
sync point: master-ac5d40e40a0155351fe1be4aab30017b6a13a859
This commit is contained in:
parent
762a84550f
commit
3603188b7f
365 changed files with 76053 additions and 53126 deletions
44
Engine/lib/openal-soft/common/dynload.cpp
Normal file
44
Engine/lib/openal-soft/common/dynload.cpp
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "dynload.h"
|
||||
|
||||
#include "strutils.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
void *LoadLib(const char *name)
|
||||
{
|
||||
std::wstring wname{utf8_to_wstr(name)};
|
||||
return LoadLibraryW(wname.c_str());
|
||||
}
|
||||
void CloseLib(void *handle)
|
||||
{ FreeLibrary(static_cast<HMODULE>(handle)); }
|
||||
void *GetSymbol(void *handle, const char *name)
|
||||
{ return reinterpret_cast<void*>(GetProcAddress(static_cast<HMODULE>(handle), name)); }
|
||||
|
||||
#elif defined(HAVE_DLFCN_H)
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
void *LoadLib(const char *name)
|
||||
{
|
||||
dlerror();
|
||||
void *handle{dlopen(name, RTLD_NOW)};
|
||||
const char *err{dlerror()};
|
||||
if(err) handle = nullptr;
|
||||
return handle;
|
||||
}
|
||||
void CloseLib(void *handle)
|
||||
{ dlclose(handle); }
|
||||
void *GetSymbol(void *handle, const char *name)
|
||||
{
|
||||
dlerror();
|
||||
void *sym{dlsym(handle, name)};
|
||||
const char *err{dlerror()};
|
||||
if(err) sym = nullptr;
|
||||
return sym;
|
||||
}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue