summaryrefslogtreecommitdiff
path: root/src/lua-plugin.cc
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2010-08-13 07:58:56 +0200
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2010-08-13 07:59:08 +0200
commit2de1daae9e11f61400e7f6685079c491d166ac88 (patch)
treef742cf0631d8405c2da7f731261cb09550356346 /src/lua-plugin.cc
parent4dcf73f8e320b9fd654229cd355fb645df24ed93 (diff)
Adding searchpath to LuaLoadPlugin
Diffstat (limited to 'src/lua-plugin.cc')
-rw-r--r--src/lua-plugin.cc12
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");