From 764e35f2110e9932dfce409ee3949fccfef521ed Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 17 Jul 2020 00:48:12 +0800 Subject: export cjson as json --- core/src/xmake/engine.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'core/src/xmake/engine.c') diff --git a/core/src/xmake/engine.c b/core/src/xmake/engine.c index cf361a8c5..337627047 100644 --- a/core/src/xmake/engine.c +++ b/core/src/xmake/engine.c @@ -224,6 +224,9 @@ tb_int_t xm_semver_select(lua_State* lua); tb_int_t xm_curses_register(lua_State* lua); #endif +// open cjson +tb_int_t luaopen_cjson(lua_State *l); + /* ////////////////////////////////////////////////////////////////////////////////////// * globals */ @@ -849,6 +852,10 @@ xm_engine_ref_t xm_engine_init(tb_char_t const* name, xm_engine_lni_initalizer_c lua_setglobal(engine->lua, "curses"); #endif + // bind json + luaopen_cjson(engine->lua); + lua_setglobal(engine->lua, "json"); + // init host xm_engine_init_host(engine); -- cgit v1.3.1 From a586eb19b8e24e97cb41918f3e692f6fc7b35368 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 17 Jul 2020 22:33:46 +0800 Subject: fix link errors for msvc --- core/src/lua-cjson/xmake.lua | 3 +++ core/src/xmake/engine.c | 2 ++ 2 files changed, 5 insertions(+) (limited to 'core/src/xmake/engine.c') diff --git a/core/src/lua-cjson/xmake.lua b/core/src/lua-cjson/xmake.lua index 9c93fb562..76caf9fc7 100644 --- a/core/src/lua-cjson/xmake.lua +++ b/core/src/lua-cjson/xmake.lua @@ -2,6 +2,9 @@ target("lua-cjson") set_kind("static") set_warnings("all") add_deps("luajit") + if is_plat("windows") then + set_languages("c89") + end add_files("lua-cjson/*.c|fpconv.c") -- Use internal strtod() / g_fmt() code for performance and disable multi-thread add_defines("NDEBUG", "USE_INTERNAL_FPCONV") diff --git a/core/src/xmake/engine.c b/core/src/xmake/engine.c index 337627047..fb6205ac5 100644 --- a/core/src/xmake/engine.c +++ b/core/src/xmake/engine.c @@ -225,7 +225,9 @@ tb_int_t xm_curses_register(lua_State* lua); #endif // open cjson +__tb_extern_c_enter__ tb_int_t luaopen_cjson(lua_State *l); +__tb_extern_c_leave__ /* ////////////////////////////////////////////////////////////////////////////////////// * globals -- cgit v1.3.1