diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lua-plugin.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lua-plugin.cc b/src/lua-plugin.cc index 817c35b..e80f0f8 100644 --- a/src/lua-plugin.cc +++ b/src/lua-plugin.cc @@ -1,13 +1,21 @@ #include <lua-plugin.h> +#if defined(_WIN32) +#define SHARED_EXT "dll" +#elif defined(__APPLE__) +#define SHARED_EXT "dylib" +#else +#define SHARED_EXT "so" +#endif + typedef void(*init_ptr_t)(Lua *); -#ifdef _WIN32 +#if defined(_WIN32) #include <windows.h> void LuaLoadPlugin(const String & _fname, Lua * L) throw (GeneralException) { HMODULE handle; - String fname = _fname + ".dll"; + String fname = _fname + "." SHARED_EXT; Base::printm(M_INFO, "Loading library " + fname + "\n"); @@ -30,7 +38,7 @@ void LuaLoadPlugin(const String & _fname, Lua * L) throw (GeneralException) { #include <dlfcn.h> void LuaLoadPlugin(const String & fname, Lua * L) throw (GeneralException) { - void * handle = dlopen(("./" + fname + ".so").to_charp(), RTLD_NOW | RTLD_GLOBAL); + void * handle = dlopen(("./" + fname + "." SHARED_EXT).to_charp(), RTLD_NOW | RTLD_GLOBAL); Base::printm(M_INFO, "Loading library " + fname + "\n"); |