From 0042b16ac34420595675d2deba9dd4a9ab8a3d4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Vavru=C5=A1a?= <marek.vavrusa@nic.cz> Date: Fri, 27 Mar 2015 15:00:17 +0100 Subject: [PATCH] daemon/engine: forward decls for Lua --- daemon/bindings.h | 4 ++++ daemon/engine.c | 1 + daemon/engine.h | 12 +++++++----- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/daemon/bindings.h b/daemon/bindings.h index bb2fc1fe3..d0e2a93d3 100644 --- a/daemon/bindings.h +++ b/daemon/bindings.h @@ -19,6 +19,10 @@ */ #pragma once +#include <lua.h> +#include <lualib.h> +#include <lauxlib.h> + #include "daemon/engine.h" /** diff --git a/daemon/engine.c b/daemon/engine.c index 12a5fede3..39ea18d87 100644 --- a/daemon/engine.c +++ b/daemon/engine.c @@ -19,6 +19,7 @@ #include <libknot/internal/mem.h> #include "daemon/engine.h" +#include "daemon/bindings.h" #include "lib/cache.h" #include "lib/defines.h" diff --git a/daemon/engine.h b/daemon/engine.h index 44a6c6abc..023d45cac 100644 --- a/daemon/engine.h +++ b/daemon/engine.h @@ -16,9 +16,11 @@ #pragma once -#include <lua.h> -#include <lualib.h> -#include <lauxlib.h> +/* + * @internal These are forward decls to allow building modules with engine but without Lua. + */ +struct lua_State; +typedef int (*lua_CFunction) (struct lua_State *L); #include "lib/resolve.h" #include "lib/generic/array.h" @@ -27,7 +29,7 @@ struct engine { struct kr_context resolver; modulelist_t modules; mm_ctx_t *pool; - lua_State *L; + struct lua_State *L; }; int engine_init(struct engine *engine, mm_ctx_t *pool); @@ -39,4 +41,4 @@ int engine_register(struct engine *engine, const char *module); int engine_unregister(struct engine *engine, const char *module); /** Return engine light userdata. */ void engine_lualib(struct engine *engine, const char *name, lua_CFunction lib_cb); -struct engine *engine_luaget(lua_State *L); \ No newline at end of file +struct engine *engine_luaget(struct lua_State *L); \ No newline at end of file -- GitLab