Wrap dlopen/dlsym

This commit is contained in:
2026-07-04 15:33:40 +10:00
parent b4cbced5f5
commit 3204613c6f
5 changed files with 97 additions and 0 deletions

22
src/FFI/getFunction.c Normal file
View File

@@ -0,0 +1,22 @@
#include "../../include/ground.h"
#ifdef _WIN32
// TODO: Windows support
#else
#include <dlfcn.h>
#endif
void* _GroundFFIGetFunction(void* handle, char* id) {
#ifdef _WIN32
// TODO: Windows support
#else
void* function = dlsym(handle, id);
char* error = dlerror();
if (error != NULL) {
Ground.Log.Error(error);
Ground.Flags.error = true;
return NULL;
}
return function;
#endif
}