lua-users home
lua-l archive

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


On 23/02/2022 20:15, Olexa Bilaniuk wrote:
> I would like to propose here a small series of 4 patches that can
> improve life for Lua developers and users alike.
...
> [2/4] Allow renaming main() function of Lua interpreter. In case Lua
> is embedded within a larger program, the following allows redefining
> the C function name main() to something else through the preprocessor.
> One useful application of this is to combine lua and luac in one
> binary that dispatches on argv[0]. This is generally smaller than lua
> and luac separately due to code sharing.


Embedding within other programs is pretty much Lua's main selling point.
You don't use lua.c at all, just the functions present in lua.h (and
whatever other .h files needed for the particular application)

Not sure it'd be a good idea to combine lua and luac together either, as
luac needs the main Lua lib statically linked, where lua needs it in a
separate so/DLL file for external libs to link against.

Scott