The public clj-zig API, meant to be aliased zig:
(require '[clj-zig.core :refer [defnz defz]] '[clj-zig :as zig])
defnz/defz (in clj-zig.core) are the everyday forms. This namespace
publishes everything else: the inspection helpers that hang off a Var,
and the data functions that make up the pipeline a macro hides
(normalize-signature, normalize-type, build-spec,
generate-source, compile!, load!). A library or macro author can
drive the whole pipeline through these without the macro.
The public clj-zig API, meant to be aliased `zig`:
(require '[clj-zig.core :refer [defnz defz]] '[clj-zig :as zig])
`defnz`/`defz` (in `clj-zig.core`) are the everyday forms. This namespace
publishes everything else: the inspection helpers that hang off a Var,
and the data functions that make up the pipeline a macro hides
(`normalize-signature`, `normalize-type`, `build-spec`,
`generate-source`, `compile!`, `load!`). A library or macro author can
drive the whole pipeline through these without the macro.(build-spec ident)Build the canonical boundary spec from {:ns :name :signature}.
Build the canonical boundary spec from `{:ns :name :signature}`.
(clean!)(clean! root)Remove the artifact cache under root (default .clj-zig/cache).
Remove the artifact cache under `root` (default `.clj-zig/cache`).
(compile! spec body)(compile! spec body gen)Compile or reuse the native library for spec and body, returning the
artifact data (paths, symbol, generated source, build status). gen
selects the source mode (:inline, :file, :raw) and carries any
C-interop options.
Compile or reuse the native library for `spec` and `body`, returning the artifact data (paths, symbol, generated source, build status). `gen` selects the source mode (`:inline`, `:file`, `:raw`) and carries any C-interop options.
(explain the-var)Render the last failed attempt for the-var, or nil when there is
nothing to explain.
Render the last failed attempt for `the-var`, or nil when there is nothing to explain.
(fn spec body)(fn spec body gen)Build a callable function from spec and body in one step:
compile! then load!.
Build a callable function from `spec` and `body` in one step: `compile!` then `load!`.
(generate-source spec body)(generate-source spec body opts)Emit the Zig wrapper for spec with body spliced in. With opts
{:mode :file :entry "name"} the wrapper instead calls a user fn.
Emit the Zig wrapper for `spec` with `body` spliced in. With `opts`
`{:mode :file :entry "name"}` the wrapper instead calls a user fn.(generated-source the-var)The full Zig wrapper generated around the body.
The full Zig wrapper generated around the body.
(library the-var)The path to the compiled shared library backing the function.
The path to the compiled shared library backing the function.
(load! artifact)Load a compiled artifact and return the callable native invoker.
Load a compiled `artifact` and return the callable native invoker.
(modules the-var)The external Zig modules the function links, each {:name :fingerprint :status}, or nil when it depends on none.
The external Zig modules the function links, each `{:name :fingerprint
:status}`, or nil when it depends on none.(normalize-signature sig)Normalize a signature vector to {:args [...] :ret <type>}.
Normalize a signature vector to `{:args [...] :ret <type>}`.
(normalize-type form)Normalize a boundary type form to its canonical data shape.
Normalize a boundary type form to its canonical data shape.
(recompile! the-var)Force a fresh build of the-var's current spec and body, ignoring the
cached artifact, and rebind. Returns the Var.
Force a fresh build of `the-var`'s current spec and body, ignoring the cached artifact, and rebind. Returns the Var.
(signature the-var)The signature vector the function was defined with.
The signature vector the function was defined with.
(source the-var)The Zig body the function was defined with.
The Zig body the function was defined with.
(source-file the-var)The path of the .zig file the body was loaded from, or nil for an
inline body.
The path of the `.zig` file the body was loaded from, or nil for an inline body.
(source-mode the-var)How the body was supplied: :inline, :file, or :raw.
How the body was supplied: `:inline`, `:file`, or `:raw`.
(spec the-var)The normalized boundary spec the function was built from.
The normalized boundary spec the function was built from.
(status the-var)Whether the backing library was freshly built (:compiled) or reused
from the cache (:cached).
Whether the backing library was freshly built (`:compiled`) or reused from the cache (`:cached`).
(symbol the-var)The stable C symbol the native function is exported under.
The stable C symbol the native function is exported under.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |