Skip to main content
The Library class represents a loaded shared library.

Example

import { dlopen, FFIType } from 'arkffi';

const lib = dlopen('libffi_target.so', {
  add: { args: [FFIType.double, FFIType.double], returns: FFIType.double },
});
lib.symbols.add(2.0, 3.0);
lib.close();

Properties

symbols

readonly symbols: ConvertFns<Fns>;
An object whose keys match function names from the defs argument. Each value is a callable function.
lib.symbols.add(2.0, 3.0);
lib.symbols.compute(0, 4.0, 'square');

Methods

close()

close(): void;
Calls dlclose() on the native library handle.
lib.close();
lib.close();  // safe to call multiple times