Skip to content

Commit

Permalink
Use .def export APIs required by luac
Browse files Browse the repository at this point in the history
This can avoid modify any lua src file
  • Loading branch information
halx99 committed Feb 18, 2022
1 parent 06479f7 commit 694712e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion thirdparty/lua/plainlua/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ set(LUA_BUILD_AS_DLL ${BUILD_SHARED_LIBS})

if(WIN32)
set(LUA_BUILD_AS_DLL TRUE)
add_library(${target_name} SHARED ${LUA_CORE})
add_library(${target_name} SHARED ${LUA_CORE} ${LUA_SRC_PATH}/plainlua.def)
else()
add_library(${target_name} ${LUA_CORE})
endif()
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/lua/plainlua/lmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,
size_t size);
LUAI_FUNC void *luaM_saferealloc_ (lua_State *L, void *block, size_t oldsize,
size_t size);
LUALIB_API void luaM_free_ (lua_State *L, void *block, size_t osize);
LUAI_FUNC void luaM_free_ (lua_State *L, void *block, size_t osize);
LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int nelems,
int *size, int size_elem, int limit,
const char *what);
Expand Down
4 changes: 2 additions & 2 deletions thirdparty/lua/plainlua/luac.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,9 @@ static void PrintCode(const Proto* f)
int sc=GETARG_sC(i);
int sbx=GETARG_sBx(i);
int isk=GETARG_k(i);
//int line=luaG_getfuncline(f,pc);
int line=luaG_getfuncline(f,pc);
printf("\t%d\t",pc+1);
//if (line>0) printf("[%d]\t",line); else printf("[-]\t");
if (line>0) printf("[%d]\t",line); else printf("[-]\t");
printf("%-9s\t",opnames[o]);
switch (o)
{
Expand Down
3 changes: 3 additions & 0 deletions thirdparty/lua/plainlua/plainlua.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
EXPORTS
luaM_free_
luaG_getfuncline

0 comments on commit 694712e

Please sign in to comment.