lua-users home
lua-l archive

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


> Would it be possible to name the symbols after the Lua version?  I'm
> wondering if something like having #define lua_foo lua53_foo for each
> symbol that is part of the public API would work.

I'm sure I don't really understand the issue, but I've have helped some
people who needed to have two different versions of Lua in their app.

I used something like this to create a suitable .h which I then included
in a custom version of one.c (see http://www.lua.org/extras/5.2/) to
build a Lua library and in the corresponding modules of their app:

	cd lua-5.2.3/src
	nm *.o | grep ' T lua' | cut -f2- -dT >1
	sed 's/ /L52_/' <1 >2 
	paste 1 2 | sed 's/^/#define/' | sort

Here is the output:

	#define luaC_barrier_	L52_luaC_barrier_
	...
	#define luaL_addlstring	L52_luaL_addlstring
	...
	#define luaZ_read	L52_luaZ_read
	#define lua_absindex	L52_lua_absindex
	...
	#define lua_yieldk	L52_lua_yieldk
	#define luaopen_base	L52_luaopen_base
	...
	#define luaopen_table	L52_luaopen_table

This does not solve the problem of dynamic linking but may be useful in
other cases.