Reworking the keyword parser, also fixed some dynamic linking issues

This commit is contained in:
2025-01-20 18:54:05 -05:00
parent a01f6f4e7b
commit 2d531b28b3
9 changed files with 243 additions and 118 deletions

View File

@@ -238,9 +238,11 @@ static std::u32string console_read() {
static void call_init_engine_wrapper(const std::filesystem::path &luprexroot, EngineWrapper *w) {
using InitFn = void (*)(EngineWrapper *);
InitFn initfn = (InitFn)dlsym(nullptr, "init_engine_wrapper");
void *exe_handle = dlopen(nullptr, RTLD_NOW | RTLD_LOCAL);
InitFn initfn = (InitFn)dlsym(exe_handle, "init_engine_wrapper");
if (initfn == nullptr) {
std::string path = luprexroot / "build/linux/luprexlib.so";
fprintf(stderr, "loading luprexlib.so...\n");
std::string path = luprexroot / "build/Linux/luprexlib.so";
void *dll_handle = dlopen(path.c_str(), RTLD_NOW | RTLD_LOCAL);
assert(dll_handle != nullptr);
initfn = (InitFn)dlsym(dll_handle, "init_engine_wrapper");