ApplesauceOS
Read Markdown ↗Download .md

C.bind

Resolve a native function and cache its prepared signature.

js
client.bind(symbol, signature)

Arguments

ArgumentTypeMeaning
symbolstringExported native symbol.
signatureobjectRequired returns and args (array of fixed type names). Optional library (absolute executable path), ownership (borrowed/retained for object results), captureErrno (boolean).

Returns

Callable bound function with release().

Example

js
const length = C.bind("strlen", {returns: "size_t", args: ["cstring"]});
console.log(length("Hello")); // 5
length.release();

Notes

Advanced API: the declared types must match the real native function. Wrong signatures/addresses can crash the target. No variadic functions, callbacks or arbitrary custom structures. Calls run on the target main thread. See C functions and memory for types and ownership.

All JavaScript APIs · Automation playbook