summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lua-plugin.cc12
-rw-r--r--src/lua-plugin.h2
2 files changed, 9 insertions, 5 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");
diff --git a/src/lua-plugin.h b/src/lua-plugin.h
index e347b6b..9e4ed4c 100644
--- a/src/lua-plugin.h
+++ b/src/lua-plugin.h
@@ -5,7 +5,7 @@
#include <Exceptions.h>
#include <Handle.h>
-void LuaLoadPlugin(const String & fname, Lua * L) throw (GeneralException);
+void LuaLoadPlugin(const String & fname, const String & searchpath, Lua * L) throw (GeneralException);
void LuaLoadPlugin(Handle * h, Lua * L) throw (GeneralException);
#endif