This commit is contained in:
Dobromir Popov
2025-09-07 15:03:47 +03:00
parent 00cda24e71
commit 2d2653551b
132 changed files with 34281 additions and 5 deletions

View File

@@ -0,0 +1,35 @@
/*
* Wrappers to emulate dlopen() on other systems like Windows
*/
#include "wraphelper.h"
#if defined(_WIN32)
void* wrap_dlopen(const char* filename)
{
return (void*)LoadLibrary(filename);
}
void* wrap_dlsym(void* h, const char* sym)
{
return (void*)GetProcAddress((HINSTANCE)h, sym);
}
int wrap_dlclose(void* h)
{
/* FreeLibrary returns non-zero on success */
return (!FreeLibrary((HINSTANCE)h));
}
#else
/* assume we can use dlopen itself... */
void* wrap_dlopen(const char* filename)
{
return dlopen(filename, RTLD_NOW);
}
void* wrap_dlsym(void* h, const char* sym)
{
return dlsym(h, sym);
}
int wrap_dlclose(void* h)
{
return dlclose(h);
}
#endif