lua-users home
lua-l archive

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

On Mon, Jul 07, 2014 at 09:41:09PM -0300, Luiz Henrique de Figueiredo wrote:
> > 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 to
> build a Lua library and in the corresponding modules of their app:
> ...
> This does not solve the problem of dynamic linking but may be useful in
> other cases.

That is pretty much what I was proposing.  The dynamic linking/loading
problem arises when two version of Lua are used in the same application.
This can happen even if the application is not using Lua iteself, but
it uses two other libraries that in turn use different versions of Lua.

Hence, if symbols are named after the Lua version, having two distinct
version of Lua linked to the same application would pose no problem
(and even let one use 2 distinct version of Lua if he has to).

But this is not a patch I would like to apply myself to Lua when I
package it for Debian.  It would be way better if this proposal, or any
other one solving the same issue, is be taken into account in the
official Lua sources.
My impression is that renaming symbols is a very portable solution,
since it is toolchain agnostic, but yes, a bunch of #define is not
particularly nice as someone already mentioned on this thread.

Enrico Tassi