1 #if defined(LUG_SYSTEM_WINDOWS) 3 inline const char* getLastErrorWindows() {
4 static const DWORD size = 200 + 1;
5 static char buffer[size];
7 auto lastError = GetLastError();
9 auto messageSize = FormatMessage(
10 FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
19 if (messageSize > 0) {
20 buffer[messageSize - 1] = 0;
31 #if defined(LUG_SYSTEM_WINDOWS) 32 handle = LoadLibraryA(name);
34 handle = dlopen(name, RTLD_LAZY | RTLD_LOCAL);
38 #if defined(LUG_SYSTEM_WINDOWS) 39 LUG_LOG.warn(
"Library: Can't load the library: {}: {}", name, getLastErrorWindows());
41 LUG_LOG.warn(
"Library: Can't load the library: {}", dlerror());
53 #if defined(LUG_SYSTEM_WINDOWS) 60 template<
typename Function>
61 inline Function
sym(
Handle handle,
const char *name) {
64 #if defined(LUG_SYSTEM_WINDOWS) 65 sym = GetProcAddress(handle, name);
67 sym = dlsym(handle, name);
71 #if defined(LUG_SYSTEM_WINDOWS) 72 LUG_LOG.warn(
"Library: Can't load the symbol {}: {}", name, getLastErrorWindows());
74 LUG_LOG.warn(
"Library: Can't load the symbol {}: {}", name, dlerror());
78 return reinterpret_cast<Function
>(
sym);
Handle open(const char *name)
void close(Handle handle)
Function sym(Handle handle, const char *name)