GUI y Windowed
En esta página
Aplicaciones sin consola
En Windows, un ejecutable estándar abre una ventana de terminal al iniciarse.
Para apps de escritorio que usan una ventana nativa (via winit/wgpu, por
ejemplo), esto es indeseable. La flag --windowed (o el alias --gui) enlaza
el .zex contra el subsistema GUI de Windows, suprimiendo la ventana de
consola:
--standalone --windowed genera un .zex sin consola en Windows; en otras
plataformas la flag se acepta pero no tiene efecto visible.
// 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.
Requiere la CLI o el host de Zolo; ábrelo en el playground o ejecútalo localmente.
La misma configuración puede definirse en zolo.toml para no tener que pasar
la flag en cada build:
[build]
gui = true
Ejecutando archivos listos
El comando zolo run acepta tanto archivos fuente .zolo como archivos ya
compilados .zex o .zar — detecta el formato automáticamente y carga el
bytecode embebido. Este es el lado del consumidor del flujo de distribución: el
autor entrega el .zex, el usuario lo ejecuta sin necesitar el fuente:
zolo run app.zex ejecuta el bytecode empaquetado — no se necesita el fuente.
// 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
Requiere la CLI o el host de Zolo; ábrelo en el playground o ejecútalo localmente.
Desafío
Compila 05-run-archive.zolo con --emit zex y luego ejecuta el .zex
generado con zolo run. Confirma que la salida es distribution sin recompilar.
Consulta también