mirror of
https://github.com/lxsang/antd-lua-plugin
synced 2025-02-13 15:02:48 +01:00
fix ld conflict
This commit is contained in:
parent
f7599cd935
commit
2f026c3273
@ -1,7 +1,7 @@
|
||||
EXTRA_DIST = lua-5.3.4/*.c lua-5.3.4/*.h lua-5.3.4/Makefile
|
||||
|
||||
all:
|
||||
cd lua-5.3.4 && make linux
|
||||
cd $(top_srcdir)/3rd/lua-5.3.4 && make linux
|
||||
|
||||
clean-local:
|
||||
cd lua-5.3.4 && make clean
|
||||
cd $(top_srcdir)/3rd/lua-5.3.4 && make clean
|
@ -27,7 +27,7 @@ MYOBJS=
|
||||
# == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE =======
|
||||
|
||||
PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
|
||||
|
||||
LUA_SO = core.so
|
||||
LUA_A= liblua.a
|
||||
CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
|
||||
lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
|
||||
@ -43,8 +43,8 @@ LUAC_T= luac
|
||||
LUAC_O= luac.o
|
||||
|
||||
ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
|
||||
ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
|
||||
ALL_A= $(LUA_A)
|
||||
ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO)
|
||||
ALL_A= $(LUA_A) $(LUA_SO)
|
||||
|
||||
# Targets start here.
|
||||
default: $(PLAT)
|
||||
@ -59,6 +59,9 @@ $(LUA_A): $(BASE_O)
|
||||
$(AR) $@ $(BASE_O)
|
||||
$(RANLIB) $@
|
||||
|
||||
$(LUA_SO): $(BASE_O)
|
||||
gcc -shared $(BASE_O) -o $@
|
||||
|
||||
$(LUA_T): $(LUA_O) $(LUA_A)
|
||||
$(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
|
||||
|
||||
|
@ -21,7 +21,6 @@ lua_la_SOURCES = plugin-wrapper.c\
|
||||
array-wrapper.c \
|
||||
json-wrapper.c \
|
||||
lua-api.c
|
||||
lua_la_LIBADD = $(srcdir)/3rd/lua-5.3.4/liblua.a
|
||||
|
||||
# lua libraris & modules
|
||||
SUBDIRS = 3rd . lib
|
||||
@ -34,4 +33,5 @@ EXTRA_DIST = README.md 3rd/jsmn/jsmn.h APIs lua-api.h
|
||||
|
||||
install-data-local:
|
||||
mkdir -p $(prefix)/lib/lua
|
||||
cp -v APIs/* $(prefix)/lib/lua
|
||||
cp -v APIs/* $(prefix)/lib/lua
|
||||
cp -v 3rd/lua-5.3.4/core.so $(prefix)/lib/lua
|
BIN
dist/lua-0.5.2b.tar.gz
vendored
BIN
dist/lua-0.5.2b.tar.gz
vendored
Binary file not shown.
19
lua-api.c
19
lua-api.c
@ -1,6 +1,9 @@
|
||||
#define PLUGIN_IMPLEMENT 1
|
||||
#include <dlfcn.h>
|
||||
#include "lua-api.h"
|
||||
|
||||
static void* core_handle = NULL;
|
||||
|
||||
static const struct luaL_Reg modules [] = {
|
||||
#ifdef USE_DB
|
||||
{"sqlite", luaopen_sqlite},
|
||||
@ -14,7 +17,17 @@ static const struct luaL_Reg modules [] = {
|
||||
|
||||
void init()
|
||||
{
|
||||
LOG("%s \n","INIT LUA HANDLER");
|
||||
char* path = __s("%s/lua/core.so", __plugin__.pdir);
|
||||
core_handle = dlopen(path, RTLD_NOW| RTLD_GLOBAL);
|
||||
if(!core_handle)
|
||||
{
|
||||
ERROR("Cannot load Lua core; %s", dlerror());
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG("Lua core loaded");
|
||||
}
|
||||
free(path);
|
||||
}
|
||||
/**
|
||||
|
||||
@ -111,5 +124,7 @@ void* handle(void* data)
|
||||
}
|
||||
void destroy()
|
||||
{
|
||||
LOG("%s \n","Exit LUA Handle");
|
||||
if(core_handle)
|
||||
dlclose(core_handle);
|
||||
LOG("Exit LUA Handle");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user