tjs:ffi
Foreign Function Interface module.
Call native C library functions directly from JavaScript. Supports loading shared libraries, defining function signatures, and working with C types including structs, pointers, and callbacks.
import { Lib, CFunction, types } from 'tjs:ffi';
const lib = new Lib(Lib.LIBC_NAME);
const getpid = new CFunction(lib.symbol('getpid'), types.sint, []);
console.log(`PID: ${getpid.call()}`);
Classes
- AdvancedType
- ArrayType
- CFunction
- DlSymbol
- JSCallback
- Lib
- Pointer
- PointerType
- StaticStringType
- StructType