</div></div><divclass="public anchor"id="var-cfn"><h3>cfn</h3><divclass="usage"><code>(cfn symbol args ret)</code></div><divclass="doc"><divclass="markdown"><p>Constructs a Clojure function to call the native function referenced by <code>symbol</code>.</p>
<p>The function returned will serialize any passed arguments into the <code>args</code> types, and deserialize the return to the <code>ret</code> type.</p>
<p>If your <code>args</code> and <code>ret</code> are constants, then it is more efficient to call <ahref="coffi.ffi.html#var-make-downcall">make-downcall</a> followed by <ahref="coffi.ffi.html#var-make-serde-wrapper">make-serde-wrapper</a> because the latter has an inline definition which will result in less overhead from serdes.</p>
</div></div><divclass="src-link"><ahref="https://github.com/IGJoshua/coffi/blob/3c16e00fc1b7ca4d34d90c00003b7ea3785d9099/src/clj/coffi/ffi.clj#L438">view source</a></div></div><divclass="public anchor"id="var-const"><h3>const</h3><divclass="usage"><code>(const symbol-or-addr type)</code></div><divclass="doc"><divclass="markdown"><p>Gets the value of a constant stored in <code>symbol-or-addr</code>.</p>
</div></div><divclass="src-link"><ahref="https://github.com/IGJoshua/coffi/blob/3c16e00fc1b7ca4d34d90c00003b7ea3785d9099/src/clj/coffi/ffi.clj#L606">view source</a></div></div><divclass="public anchor"id="var-defcfn"><h3>defcfn</h3><h4class="type">macro</h4><divclass="usage"><code>(defcfn name docstring? attr-map? symbol arg-types ret-type)</code><code>(defcfn name docstring? attr-map? symbol arg-types ret-type native-fn & fn-tail)</code></div><divclass="doc"><divclass="markdown"><p>Defines a Clojure function which maps to a native function.</p>
<p><code>name</code> is the symbol naming the resulting var. <code>symbol</code> is a symbol or string naming the library symbol to link against. <code>arg-types</code> is a vector of qualified keywords representing the argument types. <code>ret-type</code> is a single qualified keyword representing the return type. <code>fn-tail</code> is the body of the function (potentially with multiple arities) which wraps the native one. Inside the function, <code>native-fn</code> is bound to a function that will serialize its arguments, call the native function, and deserialize its return type. If any body is present, you must call this function in order to call the native code.</p>
<p>If no <code>fn-tail</code> is provided, then the resulting function will simply serialize the arguments according to <code>arg-types</code>, call the native function, and deserialize the return value.</p>
<p>The number of args in the <code>fn-tail</code> need not match the number of <code>arg-types</code> for the native function. It need only call the native wrapper function with the correct arguments.</p>
</div></div><divclass="src-link"><ahref="https://github.com/IGJoshua/coffi/blob/3c16e00fc1b7ca4d34d90c00003b7ea3785d9099/src/clj/coffi/ffi.clj#L780">view source</a></div></div><divclass="public anchor"id="var-defconst"><h3>defconst</h3><h4class="type">macro</h4><divclass="usage"><code>(defconst symbol docstring? symbol-or-addr type)</code></div><divclass="doc"><divclass="markdown"><p>Defines a var named by <code>symbol</code> to be the value of the given <code>type</code> from <code>symbol-or-addr</code>.</p>
</div></div><divclass="src-link"><ahref="https://github.com/IGJoshua/coffi/blob/3c16e00fc1b7ca4d34d90c00003b7ea3785d9099/src/clj/coffi/ffi.clj#L617">view source</a></div></div><divclass="public anchor"id="var-defvar"><h3>defvar</h3><h4class="type">macro</h4><divclass="usage"><code>(defvar symbol docstring? symbol-or-addr type)</code></div><divclass="doc"><divclass="markdown"><p>Defines a var named by <code>symbol</code> to be a reference to the native memory from <code>symbol-or-addr</code>.</p>
</div></div><divclass="src-link"><ahref="https://github.com/IGJoshua/coffi/blob/3c16e00fc1b7ca4d34d90c00003b7ea3785d9099/src/clj/coffi/ffi.clj#L683">view source</a></div></div><divclass="public anchor"id="var-ensure-symbol"><h3>ensure-symbol</h3><divclass="usage"><code>(ensure-symbol symbol-or-addr)</code></div><divclass="doc"><divclass="markdown"><p>Returns the argument if it is a <ahref="null">MemorySegment</a>, otherwise calls <ahref="coffi.ffi.html#var-find-symbol">find-symbol</a> on it.</p>
</div></div><divclass="src-link"><ahref="https://github.com/IGJoshua/coffi/blob/3c16e00fc1b7ca4d34d90c00003b7ea3785d9099/src/clj/coffi/ffi.clj#L198">view source</a></div></div><divclass="public anchor"id="var-find-symbol"><h3>find-symbol</h3><divclass="usage"><code>(find-symbol sym)</code></div><divclass="doc"><divclass="markdown"><p>Gets the <ahref="null">MemorySegment</a> of a symbol from the loaded libraries.</p>
</div></div><divclass="src-link"><ahref="https://github.com/IGJoshua/coffi/blob/3c16e00fc1b7ca4d34d90c00003b7ea3785d9099/src/clj/coffi/ffi.clj#L38">view source</a></div></div><divclass="public anchor"id="var-freset.21"><h3>freset!</h3><divclass="usage"><code>(freset! static-var newval)</code></div><divclass="doc"><divclass="markdown"><p>Sets the value of <code>static-var</code> to <code>newval</code>, running it through <ahref="coffi.mem.html#var-serialize">serialize</a>.</p>
</div></div><divclass="src-link"><ahref="https://github.com/IGJoshua/coffi/blob/3c16e00fc1b7ca4d34d90c00003b7ea3785d9099/src/clj/coffi/ffi.clj#L647">view source</a></div></div><divclass="public anchor"id="var-fswap.21"><h3>fswap!</h3><divclass="usage"><code>(fswap! static-var f & args)</code></div><divclass="doc"><divclass="markdown"><p>Non-atomically runs the function <code>f</code> over the value stored in <code>static-var</code>.</p>
</div></div><divclass="src-link"><ahref="https://github.com/IGJoshua/coffi/blob/3c16e00fc1b7ca4d34d90c00003b7ea3785d9099/src/clj/coffi/ffi.clj#L656">view source</a></div></div><divclass="public anchor"id="var-load-library"><h3>load-library</h3><divclass="usage"><code>(load-library path)</code></div><divclass="doc"><divclass="markdown"><p>Loads the library at <code>path</code>.</p>
</div></div><divclass="src-link"><ahref="https://github.com/IGJoshua/coffi/blob/3c16e00fc1b7ca4d34d90c00003b7ea3785d9099/src/clj/coffi/ffi.clj#L33">view source</a></div></div><divclass="public anchor"id="var-load-system-library"><h3>load-system-library</h3><divclass="usage"><code>(load-system-library libname)</code></div><divclass="doc"><divclass="markdown"><p>Loads the library named <code>libname</code> from the system’s load path.</p>
</div></div><divclass="src-link"><ahref="https://github.com/IGJoshua/coffi/blob/3c16e00fc1b7ca4d34d90c00003b7ea3785d9099/src/clj/coffi/ffi.clj#L28">view source</a></div></div><divclass="public anchor"id="var-make-downcall"><h3>make-downcall</h3><divclass="usage"><code>(make-downcall symbol-or-addr args ret)</code></div><divclass="doc"><divclass="markdown"><p>Constructs a downcall function reference to <code>symbol-or-addr</code> with the given <code>args</code> and <code>ret</code> types.</p>
<p>The function returned takes only arguments whose types match exactly the <ahref="coffi.mem.html#var-java-layout">java-layout</a> for that type, and returns an argument with exactly the <ahref="coffi.mem.html#var-java-layout">java-layout</a> of the <code>ret</code> type. This function will perform no serialization or deserialization of arguments or the return type.</p>
</div></div><divclass="src-link"><ahref="https://github.com/IGJoshua/coffi/blob/3c16e00fc1b7ca4d34d90c00003b7ea3785d9099/src/clj/coffi/ffi.clj#L206">view source</a></div></div><divclass="public anchor"id="var-make-serde-varargs-wrapper"><h3>make-serde-varargs-wrapper</h3><divclass="usage"><code>(make-serde-varargs-wrapper varargs-factory required-args ret-type)</code></div><divclass="doc"><divclass="markdown"><p>Constructs a wrapper function for the <code>varargs-factory</code> which produces functions that serialize the arguments and deserialize the return value.</p>
</div></div><divclass="src-link"><ahref="https://github.com/IGJoshua/coffi/blob/3c16e00fc1b7ca4d34d90c00003b7ea3785d9099/src/clj/coffi/ffi.clj#L426">view source</a></div></div><divclass="public anchor"id="var-make-serde-wrapper"><h3>make-serde-wrapper</h3><divclass="usage"><code>(make-serde-wrapper downcall arg-types ret-type)</code></div><divclass="doc"><divclass="markdown"><p>Constructs a wrapper function for the <code>downcall</code> which serializes the arguments and deserializes the return value.</p>
</div></div><divclass="src-link"><ahref="https://github.com/IGJoshua/coffi/blob/3c16e00fc1b7ca4d34d90c00003b7ea3785d9099/src/clj/coffi/ffi.clj#L407">view source</a></div></div><divclass="public anchor"id="var-make-varargs-factory"><h3>make-varargs-factory</h3><divclass="usage"><code>(make-varargs-factory symbol required-args ret)</code></div><divclass="doc"><divclass="markdown"><p>Returns a function for constructing downcalls with additional types for arguments.</p>
<p>The <code>required-args</code> are the types of the first arguments passed to the downcall handle, and the values passed to the returned function are only the varargs types.</p>
<p>The returned function is memoized, so that only one downcall function will be generated per combination of argument types.</p>
</div></div><divclass="src-link"><ahref="https://github.com/IGJoshua/coffi/blob/3c16e00fc1b7ca4d34d90c00003b7ea3785d9099/src/clj/coffi/ffi.clj#L222">view source</a></div></div><divclass="public anchor"id="var-reify-libspec"><h3>reify-libspec</h3><divclass="usage"><code>(reify-libspec libspec)</code></div><divclass="doc"><divclass="markdown"><p>Loads all the symbols specified in the <code>libspec</code>.</p>
</div></div><divclass="src-link"><ahref="https://github.com/IGJoshua/coffi/blob/3c16e00fc1b7ca4d34d90c00003b7ea3785d9099/src/clj/coffi/ffi.clj#L742">view source</a></div></div><divclass="public anchor"id="var-reify-symbolspec"><h3>reify-symbolspec</h3><h4class="type">multimethod</h4><divclass="usage"></div><divclass="doc"><divclass="markdown"><p>Takes a spec for a symbol reference and returns a live value for that type.</p>
</div></div><divclass="src-link"><ahref="https://github.com/IGJoshua/coffi/blob/3c16e00fc1b7ca4d34d90c00003b7ea3785d9099/src/clj/coffi/ffi.clj#L701">view source</a></div></div><divclass="public anchor"id="var-static-variable"><h3>static-variable</h3><divclass="usage"><code>(static-variable symbol-or-addr type)</code></div><divclass="doc"><divclass="markdown"><p>Constructs a reference to a mutable value stored in <code>symbol-or-addr</code>.</p>
</div></div><divclass="src-link"><ahref="https://github.com/IGJoshua/coffi/blob/3c16e00fc1b7ca4d34d90c00003b7ea3785d9099/src/clj/coffi/ffi.clj#L672">view source</a></div></div><divclass="public anchor"id="var-static-variable-segment"><h3>static-variable-segment</h3><divclass="usage"><code>(static-variable-segment static-var)</code></div><divclass="doc"><divclass="markdown"><p>Gets the backing <ahref="null">MemorySegment</a> from <code>static-var</code>.</p>
</div></div><divclass="src-link"><ahref="https://github.com/IGJoshua/coffi/blob/3c16e00fc1b7ca4d34d90c00003b7ea3785d9099/src/clj/coffi/ffi.clj#L664">view source</a></div></div><divclass="public anchor"id="var-vacfn-factory"><h3>vacfn-factory</h3><divclass="usage"><code>(vacfn-factory symbol required-args ret)</code></div><divclass="doc"><divclass="markdown"><p>Constructs a varargs factory to call the native function referenced by <code>symbol</code>.</p>
<p>The function returned takes any number of type arguments and returns a specialized Clojure function for calling the native function with those arguments.</p>