[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Packaging issue: standalone interpreter requires dynamic linking
- From: Norman Ramsey <nr@...>
- Date: Sat, 10 May 2008 15:35:59 -0400
> > could someone please make it easier to open an arbitrarily large set
> > of libraries right after luaL_openlibs(L)
>
> Perhaps I'm missing something but the usual solution for that is to
> copy linit.c and edit it at will... we have provided linit.c as a
> separate module that users can replace wih their own version
> without rebuilding Lua...
OK, I'm willing to wear the dunce cap for not finding that on my own.
But I would still prefer that there be an additional name in the name
space so that *no* editing is required. For example linit.c might
read as follows:
LUALIB_API void luaL_openlibs (lua_State *L) {
return luaL_opencorelibs(L);
}
LUALIB_API void luaL_opencorelibs (lua_State *L) {
const luaL_Reg *lib = lualibs;
for (; lib->func; lib++) {
lua_pushcfunction(L, lib->func);
lua_pushstring(L, lib->name);
lua_call(L, 1, 0);
}
}
Now I can write my own .o that replaces luaL_openlibs *without* having
to clone and modify either the luaL_opencorelibs function or the
'lualibs' table upon which it relies.
I am not the only one to want to customize a binary without having to
edit any source code:
http://tinyurl.com/5ta3wp
Norman
P.S. Changing luaconf.h still counts as 'editing source code' :-)