lua-users home
lua-l archive

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


Viacheslav Usov wrote on 2/18/2017 8:16 AM:
On Sat, Feb 18, 2017 at 4:10 PM, Joshua Jensen <josh.jjensen@gmail.com> wrote:

> I statically linked 2 versions of Lua once in the same executable. It involved compiling one version of Lua as C++ and wrapping a namespace around each file for minimal change.

That is actually a great idea, because my application already does the C++ thing for its sole Lua version. I could do the same thing with the other ones. My only concern here is the macros. Do you have any particular comments about that?
I didn't expose lua.h and company publicly. My wrapper at the time was the C++ LuaPlus library, so all Lua functionality was exposed, just through a different API. I wasn't happy about it, because LuaPlus generally inlines everything, but it was necessary.

Your other choice is to turn all macros into functions with the bodies of the functions in a .c file. That's a lot of surgery, but hey, getting two Lua versions to work statically is a lot of surgery anyway.

-Josh