add dynamic

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@687 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-11-13 03:34:33 +00:00
parent 5bd20cee74
commit 4df3f4658b
6 changed files with 77 additions and 6 deletions

26
src/abstract/dynamic.c Normal file
View File

@@ -0,0 +1,26 @@
/* $Id$ */
#include <Mw/Milsko.h>
void* MwDynamicOpen(const char* path) {
#ifdef _WIN32
return LoadLibrary(path);
#else
return dlopen(path, RTLD_LAZY | RTLD_LOCAL);
#endif
}
void* MwDynamicSymbol(void* handle, const char* symbol) {
#ifdef _WIN32
return GetProcAddress(handle, symbol);
#else
return dlsym(handle, symbol);
#endif
}
void MwDynamicClose(void* handle) {
#ifdef _WIN32
FreeLibrary(handle);
#else
dlclose(handle);
#endif
}