summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNicolas Noble <pixel@Shinji.local>2008-12-03 04:36:07 -0800
committerNicolas Noble <pixel@Shinji.local>2008-12-03 04:36:07 -0800
commit67e09363f365d5f0924b78c07993519095901d1e (patch)
tree5ea4e536265292fe07c34790096f2d4850f00b70 /src
parente0402b2b38cb866885f0c21282da5b42cc4188b6 (diff)
Implementing Darwin support.
Diffstat (limited to 'src')
-rw-r--r--src/lua-plugin.cc14
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");