milsko/src/abstract/dynamic.c

27 lines
565 B
C
Raw Normal View History

#include <Mw/Milsko.h>
#if defined(_WIN32)
void* MwDynamicOpen(const char* path) {
return LoadLibrary(path);
}
void* MwDynamicSymbol(void* handle, const char* symbol) {
return GetProcAddress(handle, symbol);
}
void MwDynamicClose(void* handle) {
FreeLibrary(handle);
}
2026-01-09 14:43:44 -07:00
#elif defined(__unix__) || defined(__APPLE__)
void* MwDynamicOpen(const char* path) {
return dlopen(path, RTLD_LOCAL | RTLD_LAZY);
}
void* MwDynamicSymbol(void* handle, const char* symbol) {
return dlsym(handle, symbol);
}
void MwDynamicClose(void* handle) {
dlclose(handle);
}
#endif