Skip to main content
The raw bridge provides direct access to the NAPI functions exported from liblibrary.so.

Import

API Reference

load()

Calls dlopen() on the given library. Returns a bigint handle.

close()

Calls dlclose() on the library handle.

defineFunction()

Resolves a function via dlsym() and registers its type signature.

callBySig()

Calls a previously registered function.

callMixed()

One-shot call — dlsym() + type dispatch in a single call.

callString()

Calls a C function returning const char*.

readCString()

Reads a null-terminated C string from a raw pointer.

callPtr()

Calls a function by its raw pointer, skipping dlsym().

callPtrAsync()

Async version of callPtr — executes on a libuv worker thread and returns a Promise without blocking the JS thread.

getSymbolPtr()

Returns the raw function pointer for a symbol.

createCallback()

Stores a TS function in the callback registry. Returns a slot handle.

destroyCallback()

Removes a callback from the registry.

invokeCallback()

Invokes a stored callback by its handle.

getCallbackThreadsafe()

Returns whether the callback is thread-safe.

getCallbackPtr()

Returns the callback function pointer.
  • Non-threadsafe: returns the slot handle
  • Threadsafe: returns a real executable trampoline address

callCallbackThreadSafe()

Calls a callback through the TSFN path for verification purposes.

ptr()

Gets the underlying memory pointer of an ArrayBuffer or TypedArray.