瀏覽代碼

CE_EXPORT macro defined for exporting symbols, luaopen_libcrownlua exported

mikymod 12 年之前
父節點
當前提交
0e86e726df
共有 2 個文件被更改,包括 11 次插入11 次删除
  1. 2 5
      src/lua/LuaEnvironment.cpp
  2. 9 6
      src/lua/LuaEnvironment.h

+ 2 - 5
src/lua/LuaEnvironment.cpp

@@ -23,10 +23,7 @@ void LuaEnvironment::load_module_function(const char* module, const char* name,
 	luaL_register(m_state, module, entry);
 	luaL_register(m_state, module, entry);
 }
 }
 
 
-extern "C"
-{
-
-int32_t luaopen_libcrownlua(lua_State* L)
+CE_EXPORT int32_t luaopen_libcrownlua(lua_State* L)
 {
 {
 	LuaEnvironment env(L);
 	LuaEnvironment env(L);
 
 
@@ -45,7 +42,7 @@ int32_t luaopen_libcrownlua(lua_State* L)
 	return 1;
 	return 1;
 }
 }
 
 
-} // extern "C"
+
 
 
 
 
 } // namespace crown
 } // namespace crown

+ 9 - 6
src/lua/LuaEnvironment.h

@@ -2,6 +2,14 @@
 
 
 #include "lua.hpp"
 #include "lua.hpp"
 #include "Types.h"
 #include "Types.h"
+#include "Config.h"
+
+#ifdef WINDOWS
+	#define CE_EXPORT extern "C" __declspec(dllexport)
+#else
+	#define CE_EXPORT
+#endif
+
 
 
 namespace crown
 namespace crown
 {
 {
@@ -37,11 +45,6 @@ void load_camera(LuaEnvironment& env);
 
 
 void load_device(LuaEnvironment& env);
 void load_device(LuaEnvironment& env);
 
 
-extern "C"
-{
-	int32_t luaopen_libcrownlua(lua_State* L);
-}
-
-
+CE_EXPORT int32_t luaopen_libcrownlua(lua_State* L);
 
 
 } // namespace crown
 } // namespace crown