native
experimentalTyped native C and C++ functions, public C++ objects and vcpkg libraries.
use plugin native Plugin snippets can be edited in the Playground, but native capabilities are executed locally with the Zolo CLI.
From import to result
- 01Import only what you use
- 02Copy the smallest example
- 03Run it with the Zolo CLI
Functions¶
| Provider | Description |
|---|---|
c |
C17 functions and source/header imports |
cpp |
C++17 functions and public class imports |
Preparation compiles a native library; authored invocations execute in the Zolo process. Function signatures use Zolo types and bodies use C or C++.
use plugin native::{cpp}
extern cpp fn twice(value: int) -> int { return value * 2; }
print(twice(21))int preserves signed 64-bit values. C++ strings use std::string; C strings
use length-aware bridge adapters. Collections/records use explicit zolo_value
adapters. Narrow conversions are checked. Public C++ constructors, methods,
fields and static methods support ordinary Zolo calls; pointers, varargs, open
templates and ownership-dependent APIs need a concrete typed wrapper.
Typed C++ callbacks are directly callable. C uses the explicit
zolo_callback_call/zolo_callback_release bridge API. Callbacks are valid
during the current invocation and support nested Zolo calls. Retained or
unrelated-thread calls fail. Async functions schedule ordinary native work and
expose a Zolo Future; cancellation closes delivery without forcibly interrupting
native instructions.
Global extern cpp deps and [foreign.native.dependencies] select vcpkg
ports, versions and features. Baseline, triplet and CRT become part of the
locked environment. The Windows default triplet is x64-windows-static.
Use zolo install and the common offline/frozen policies.
Preparation requires Clang plus platform headers/linker. ZOLO_CLANG selects
the compiler; semantic editor queries use clangd. Analysis never loads authored
libraries or runs initializers. Artifacts include native libraries, selected
release dependency assets and source snapshots. VM/native/LLVM support
dynamic/embed/static deployment without the original sources or compilers.
C++ exceptions include an authored function frame; exact inner throw lines require debug information. Native crashes retain native process semantics. Runtime validation currently covers Windows x64. Hosted wasm-aot and cross-target artifacts are rejected. See native examples and dependency policies.