Skip to content

Standalone Binary

A .zex generated without additional flags still requires zolo on the target machine. The --standalone flag solves this: the runtime is concatenated into the ZIP file, and the executable locates itself via the ZIP EOCD record at startup — no external installation needed.

--emit zex --standalone produces a self-contained .zex; run it on any machine, even without zolo installed.

03-standalone.zolo
// Feature: self-contained executable — `--standalone`
// Syntax: `zolo build file.zolo --emit zex --standalone`
// When to use: distribute a `.zex` that runs WITHOUT a separate `zolo`
//   install — the runtime is embedded into the archive.

// Run:
//   zolo build 31-distribution/03-standalone.zolo --emit zex --standalone
//   # the resulting .zex embeds the runtime; double-clicking or running
//   # it directly works on a machine that has no `zolo` installed.
//
// How it works: the runtime executable is concatenated with the ZIP
// payload; the program locates its own appended archive via the ZIP
// EOCD record at startup and executes it. (See the archive spec.)

print("I bring my own runtime — no `zolo` needed to run me.")

// Pair with --release for an optimized standalone, and with
// --windowed/--gui (see 04) for a console-free GUI app on Windows.
//
// expected: I bring my own runtime — no `zolo` needed to run me.

Requires the Zolo CLI/host — open in the playground or run locally.

For production distribution, combine --standalone with --release for bytecode optimization:

zolo build app.zolo --emit zex --standalone --release

The output file is placed at target/<name>-<version>.zex (the version comes from zolo.toml, defaulting to 0.0.0).

enespt-br