Convert to a true DLL engine
This commit is contained in:
@@ -158,12 +158,10 @@
|
||||
#include "wrap-set.hpp"
|
||||
#include <cstring>
|
||||
|
||||
extern "C" {
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
#include "lualib.h"
|
||||
#include "eris.h"
|
||||
}
|
||||
|
||||
class LuaSlot : public eng::nevernew {
|
||||
protected:
|
||||
|
||||
@@ -217,17 +217,11 @@ static int console_read(char *bytes, int nbytes) {
|
||||
return read(0, bytes, nbytes);
|
||||
}
|
||||
|
||||
// Load the DLL if it's not already loaded. Stores
|
||||
// the handle in a global variable.
|
||||
static void load_engine_dll() {
|
||||
// Not actually implemented yet. Currently, the engine
|
||||
// is linked right into the executable.
|
||||
}
|
||||
|
||||
static void call_init_engine_wrapper(EngineWrapper *w) {
|
||||
load_engine_dll();
|
||||
using InitFn = void (*)(EngineWrapper *);
|
||||
InitFn initfn = (InitFn)dlsym(RTLD_DEFAULT, "init_engine_wrapper");
|
||||
void *dll_handle = dlopen("./luprex.so", RTLD_NOW | RTLD_LOCAL);
|
||||
assert(dll_handle != nullptr);
|
||||
InitFn initfn = (InitFn)dlsym(dll_handle, "init_engine_wrapper");
|
||||
assert(initfn != nullptr);
|
||||
initfn(w);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user