.so libraries directly from ArkTS — no NAPI bindings required.
Getting Started
Install, configure, and call your first C function in minutes.
API Reference
Complete reference for dlopen, FFIType, CString, CFunction, and JSCallback.
Guides
Deep dives into mixed types, function pointers, callbacks, and external libraries.
Overview
arkffi provides three layers of abstraction:| Layer | Description |
|---|---|
| Raw NAPI Bridge | load, close, callMixed, callBySig, callString, readCString, getSymbolPtr, callPtr |
dlopen wrapper | Declarative dlopen() with dictionary-style function definitions and typed symbols |
| CFunction / JSCallback | Function pointer wrapping and JavaScript callback support |
Features
- Call any exported C function from a
.solibrary - Supports
int32,int64,double,float,bool,pointer,cstring,callback - Mixed parameter types (
int+double+stringin one call) - Function pointer support via
CFunction - JavaScript callbacks via
JSCallbackwith optionalthreadsafemode - C string reading via
CString - TypeScript generics for IDE code completion