Skip to main content
AKI (Alpha Kernel Interacting) is another FFI framework for HarmonyOS, with a fundamentally different design philosophy from arkffi.

Architecture Comparison

When to Choose arkffi

1. Calling external pre-built .so libraries

arkffi’s core advantage: no compilation needed, no source code needed. When you have a pre-compiled .so from a third party (e.g., closed-source SDK, algorithm library compiled via NDK, CLion project output), arkffi can load and call it at runtime:
AKI cannot do this — it requires all C++ source to be part of the project build.

2. Rapid prototyping

arkffi only needs ohpm install arkffi — no CMakeLists.txt modifications, no C++ code, no NAPI knowledge required. From install to first C function call in minutes.

3. bun:ffi migration or cross-development

If your team is familiar with bun:ffi’s dlopen(path, { funcName: { args, returns } }) declarative style, arkffi provides the exact same API pattern with zero learning cost.

4. Dynamic library hot-reload

ffi.load / ffi.close allows loading and unloading .so files at runtime, suitable for plugin systems or dynamic module scenarios.

5. Flexible mixed-type calls

arkffi’s type encoding system ('i', 'd', 's', etc.) supports arbitrary mixed-signature calls in a single invocation, without writing C++ wrappers for each signature:

When to Choose AKI

  • Binding C++ classes/structs: AKI’s JSBIND_CLASS and JSBIND_METHOD can fully expose C++ classes to ArkTS.
  • Complex async operations: AKI has built-in TaskRunner and AsyncWorker.
  • API 9~11 compatibility: arkffi requires API 12+.
  • C++ macro-style preferred: AKI’s compile-time binding is more controllable in large C++ projects.

Decision Guide