@@ -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
@@ -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);
- int32_t luaopen_libcrownlua(lua_State* L);
-}
+CE_EXPORT int32_t luaopen_libcrownlua(lua_State* L);