From f5355395b70772e821452935c5251bda70154469 Mon Sep 17 00:00:00 2001 From: Rinat Namazov Date: Thu, 13 May 2021 22:24:31 +0300 Subject: [PATCH] Added FFI enabled check --- include/sol/compatibility/lua_version.hpp | 8 ++++++++ include/sol/state_view.hpp | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/sol/compatibility/lua_version.hpp b/include/sol/compatibility/lua_version.hpp index d640c09a..21011600 100644 --- a/include/sol/compatibility/lua_version.hpp +++ b/include/sol/compatibility/lua_version.hpp @@ -70,6 +70,14 @@ #define SOL_LUAJIT_VERSION_I_ 0 #endif +#if defined(SOL_LUAJIT_FFI_DISABLED) + #define SOL_LUAJIT_FFI_DISABLED_I_ SOL_ON +#elif defined(LUAJIT_DISABLE_FFI) + #define SOL_LUAJIT_FFI_DISABLED_I_ SOL_ON +#else + #define SOL_LUAJIT_FFI_DISABLED_I_ SOL_DEFAULT_OFF +#endif + #if defined(MOONJIT_VERSION) #define SOL_USE_MOONJIT_I_ SOL_ON #else diff --git a/include/sol/state_view.hpp b/include/sol/state_view.hpp index 499f24bc..6cbcf118 100644 --- a/include/sol/state_view.hpp +++ b/include/sol/state_view.hpp @@ -189,7 +189,7 @@ namespace sol { #endif // Lua 5.3+ only break; case lib::ffi: -#if SOL_IS_ON(SOL_USE_LUAJIT_I_) +#if SOL_IS_ON(SOL_USE_LUAJIT_I_) && SOL_IS_OFF(SOL_LUAJIT_FFI_DISABLED_I_) luaL_requiref(L, "ffi", luaopen_ffi, 1); lua_pop(L, 1); #endif // LuaJIT only