Skip to main content

embed_bytecode

Function embed_bytecode 

Source
pub fn embed_bytecode(
    source_path: &Path,
    out_path: &Path,
    target_triple: Option<&str>,
    version: LuaVersion,
) -> Result<(), AotError>
Expand description

Compile source_path into out_path (a native binary embedding the dumped luna bytecode in a .luna.bytecode section).

target_triple is parsed only for the host-vs-cross check; the scaffold only supports the host triple. Pass None to default to the host.

version selects the Lua dialect for parsing + bytecode emit (defaults to LuaVersion::Lua55 when called via the CLI).

ยงEnd-to-end behaviour

The produced binary is runnable: it prints the embedded bytecode length to stderr and exits 0. It does not execute the bytecode; use compile_and_link for a binary that runs the script through a Vm.