Skip to content

35 · Distribution

GUI and Windowed

Distribute desktop apps without a console window using `--windowed` / `--gui`; run ready-made files with `zolo run`.

On this page

Console-less applications

On Windows, a standard executable opens a terminal window when launched. For desktop apps that use a native window (via winit/wgpu, for example), this is undesirable. The --windowed flag (or its alias --gui) links the .zex against the Windows GUI subsystem, suppressing the console window:

--standalone --windowed generates a console-free .zex on Windows; on other platforms the flag is accepted but has no visible effect.

04-windowed-gui.zolo
// Feature: console-free GUI build — `--windowed` / `--gui`
// Syntax: `zolo build file.zolo --emit zex --standalone --windowed`
// When to use: ship a desktop/GUI app on Windows that should NOT pop up
//   a console window when launched.

// Run (Windows):
//   zolo build 31-distribution/04-windowed-gui.zolo --emit zex --standalone --windowed
//   # `--gui` is an alias for `--windowed`.
//
// `--windowed` builds a standalone Windows `.zex` linked against the GUI
// subsystem, so double-clicking it opens no console window. On other
// platforms the flag is accepted but a console app is the norm.
//
// You can also set this in zolo.toml instead of passing the flag:
//   [build]
//   gui = true

// A GUI program typically opens a window (winit/wgpu) rather than printing.
// This stub just shows the build invocation; for a real window see the
// graphics examples under ../../../examples/.
print("Built as a windowed app — no console on Windows.")

// expected (when run from a terminal): the line above.

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

The same setting can be defined in zolo.toml to avoid passing the flag on every build:

[build]
gui = true

Running ready-made files

The zolo run command accepts both .zolo source files and already-compiled .zex or .zar files — it detects the format automatically and loads the embedded bytecode. This is the consumer side of the distribution workflow: the author delivers the .zex, and the user runs it without needing the source:

zolo run app.zex executes the packaged bytecode — no source needed.

05-run-archive.zolo
// Feature: run a built archive — `zolo run <archive>`
// Syntax: `zolo run app.zex`  |  `zolo run lib.zar`
// When to use: execute a `.zex`/`.zar` you (or someone else) built,
//   without rebuilding from source.

// Workflow:
//   zolo build 31-distribution/05-run-archive.zolo --emit zex
//   zolo run   target/05-run-archive-0.0.0.zex
//
// `zolo run` accepts a `.zolo` source file OR a prebuilt `.zex`/`.zar`
// archive — it detects the format and loads the embedded bytecode. This
// is the consumer side of the distribution flow:
//
//   author:   zolo build app.zolo --emit zex   (produces app.zex)
//   consumer: zolo run app.zex                 (no source needed)

let parts = ["dist", "ribut", "ion"]
print(parts.join(""))

// expected: distribution

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

Challenge

Compile 05-run-archive.zolo with --emit zex and then run the generated .zex with zolo run. Confirm that the output is distribution without recompiling.

Global index

Find your way through Zolo

Try an idea

Start here

9 results

9 results

enespt-br