Liking cljdoc? Tell your friends :D

clj-zig.spec

Build the canonical boundary spec for a defnz function. Pure: an identity-plus-signature map goes in, a validated spec comes out, or a diagnostic is thrown.

The spec is the native boundary contract that source generation, FFM binding, and cache hashing all consume:

{:ns app.core
 :name add
 :symbol "clj_zig_app_2e_core_add"
 :params [{:binding x :type {:kind :scalar :name :i64}}
          {:binding y :type {:kind :scalar :name :i64}}]
 :ret {:kind :scalar :name :i64}
 :signature [x :i64 y :i64 :ret :i64]}

:params is the flat list of native parameters in call order. Clojure-side destructuring is expanded here: each destructured local becomes one native param tagged with :destructured-from, so the core macro can lower a map argument to scalars before the call.

Build the canonical boundary spec for a `defnz` function. Pure: an
identity-plus-signature map goes in, a validated spec comes out, or a
diagnostic is thrown.

The spec is the native boundary contract that source generation, FFM
binding, and cache hashing all consume:

    {:ns app.core
     :name add
     :symbol "clj_zig_app_2e_core_add"
     :params [{:binding x :type {:kind :scalar :name :i64}}
              {:binding y :type {:kind :scalar :name :i64}}]
     :ret {:kind :scalar :name :i64}
     :signature [x :i64 y :i64 :ret :i64]}

`:params` is the flat list of native parameters in call order.
Clojure-side destructuring is expanded here: each destructured
local becomes one native param tagged with `:destructured-from`, so the
core macro can lower a map argument to scalars before the call.
raw docstring

build-specclj

(build-spec {:keys [ns name signature types] :or {types {}}})

Build the boundary spec from {:ns :name :signature}, resolving any named-type references against an optional :types map. Throws a diagnostic (ex-info) when the contract is invalid.

Build the boundary spec from `{:ns :name :signature}`, resolving any
named-type references against an optional `:types` map. Throws a
diagnostic (`ex-info`) when the contract is invalid.
sourceraw docstring

symbol-nameclj

(symbol-name var-ns var-name)

The stable, collision-free C symbol for a Var: clj_zig_<ns>_<name>.

The stable, collision-free C symbol for a Var: `clj_zig_<ns>_<name>`.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close