lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

recompile Lua with -fPIC flag and fix it .

On Mon, Nov 26, 2012 at 8:35 PM, chuang <> wrote:
I try to compile it under debian,but get errors:
/usr/bin/ld: /usr/local/lib/liblua.a(lapi.o): relocation R_X86_64_32 against `luaO_nilobject_' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/liblua.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[1]: *** [lanes/] Error 1

On Mon, Nov 26, 2012 at 10:48 AM, chuang <> wrote:
Yeah,cool!That is what  exactly  I want.

On Sun, Nov 25, 2012 at 11:30 PM, Declan White <> wrote:
chuang <lichuang1982 <at>> writes:

> I want to write a C module,when Lua call this module's spawn function,it
create a new Lua state,and the new Lua state can call its Lua function,like
> require("qnode")
> function test(a)
>   print("in test")
>   print(a)
> end
> qnode.spawn(test, 100)
> but,when i review the Lua C API,seems there is no function to get the Lua
function from the Lua stack.
> So,how can I achieve this  purpose?

Take a look at LuaLanes ( ); it has a few C
functions to copy from Lua state to another.
(In fact, it may do exactly what you want your module to do: multiple Lua states
in separate threads with simple communication).

There's also my deep copy function, which you can find on lua-users ( ); although it is Lua-only, so you'll have
to find a way to convert it.

Declan White.