diff options
Diffstat (limited to 'src/lua-plugin.cc')
-rw-r--r-- | src/lua-plugin.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/lua-plugin.cc b/src/lua-plugin.cc index 1e4ebc7..3c08201 100644 --- a/src/lua-plugin.cc +++ b/src/lua-plugin.cc @@ -15,7 +15,7 @@ typedef void(*init_ptr_t)(Lua *); #include <windows.h> #include "MemoryModule.h" -void LuaLoadPlugin(const String & _fname, Lua * L) throw (GeneralException) { +void LuaLoadPlugin(const String & _fname, const String & searchpath, Lua * L) throw (GeneralException) { HMODULE handle; String fname = _fname + "." SHARED_EXT; @@ -67,15 +67,19 @@ void LuaLoadPlugin(Handle * h, Lua * L) throw (GeneralException) { #else #include <dlfcn.h> -void LuaLoadPlugin(const String & fname, Lua * L) throw (GeneralException) { +void LuaLoadPlugin(const String & fname, const String & searchpath, Lua * L) throw (GeneralException) { String full_fname = "./" + fname + "." SHARED_EXT; void * handle = dlopen(full_fname.to_charp(), RTLD_NOW | RTLD_GLOBAL); Base::printm(M_INFO, "Loading library " + fname + "\n"); if (!handle) { - LuaLoadPlugin(&Input(fname + "." SHARED_EXT), L); - return; + full_fname = searchpath + fname + "." SHARED_EXT + handle = dlopen(full_fname.to_charp(), RTLD_NOW | RTLD_GLOBAL); + if (!handle) { + LuaLoadPlugin(&Input(fname + "." SHARED_EXT), L); + return; + } } init_ptr_t init_ptr = (init_ptr_t) dlsym(handle, "init_plugin"); |