Просмотр исходного кода

CE_EXPORT macro defined for exporting symbols, luaopen_libcrownlua exported

mikymod 12 лет назад
Родитель
Сommit
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);
 }
 
-extern "C"
-{
-
-int32_t luaopen_libcrownlua(lua_State* L)
+CE_EXPORT int32_t luaopen_libcrownlua(lua_State* L)
 {
 	LuaEnvironment env(L);
 
@@ -45,7 +42,7 @@ int32_t luaopen_libcrownlua(lua_State* L)
 	return 1;
 }
 
-} // extern "C"
+
 
 
 } // namespace crown

+ 9 - 6
src/lua/LuaEnvironment.h

@@ -2,6 +2,14 @@
 
 #include "lua.hpp"
 #include "Types.h"
+#include "Config.h"
+
+#ifdef WINDOWS
+	#define CE_EXPORT extern "C" __declspec(dllexport)
+#else
+	#define CE_EXPORT
+#endif
+
 
 namespace crown
 {
@@ -37,11 +45,6 @@ void load_camera(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