lua-users home
lua-l archive

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

Jay Carlson wrote:
I'm confused. Why don't you just use the linker to put in the data that you want? The most portable way to do this is just stuff everything into a const char[] and compile it. If you want to skip the octets->.c->.o overhead I suppose you could use objcopy to go directly from octets->.o, or use a linker script for more control.

If the goal is to avoid having the whole development environment including headers on the machine performing the append, then ship a partially linked version of the lua executable with a weak symbol that will be supplied by the .o containing the octets. The target machine then just needs objcopy and a linker.

If you can't depend on having a linker on the target machine, yeah, you're going to have to play around with libelf like lhf says. But just about everybody has a linker.

Not on Windows.

A typical use I saw with AutoIt, an tool to automate GUI tasks on Windows, is to have an exe (the runtime) and a tool to glue the user's code to the exe to make self-running scripts.

The target is end users, knowing (near to) nothing to programming (the syntax is very primitive, close to .bat/.cmd), which are unlikely to have any programming tool like a linker.

Philippe Lhoste
--  (near) Paris -- France
--  --  --  --  --  --  --  --  --  --  --  --  --  --