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 { dlopen } from 'tjs:ffi';
const { symbols } = dlopen('c', {
getpid: { returns: 'i32' },
});
console.log(`PID: ${symbols.getpid()}`);
Classes
Interfaces
- AllocatedStruct
- AllocStructOptions
- DlopenCProtoResult
- DlopenResult
- DlopenSymbol
- EnumDef
- ExternalArrayBuffer
- NativePointer
- SimpleType
- StructDef
- StructFieldInfo
- StructFieldOptions
Type Aliases
- MapArrayToJsType
- MapSymbolToJsValue
- MapToJsType
- StructField
- StructFieldType
- StructValidator
- StructValues
- TypeAlias
- TypeAliasMap
- TypeAliasTypeMap
- TypeOrAlias