Crate ohos_sys

source ·
Expand description

Ohos-sys

This crate provides Raw FFI bindings to the native API of OpenHarmonyOS (target_env = "ohos"). Each module corresponds to one OpenHarmony API feature, and is gated behind a cargo feature. If you are an application developer, you probably do not want to use this crate directly, and instead want to use a higher-level API built on top of this crate.

Note: There are currently still quite a few missing bindings, which will slowly be added.

§Feature flags

  • drawing — Enables bindings to native_drawing. Re-exports ohos-drawing-sys.
  • hilog — Enables bindings to hilog
  • napi — Enables bindings to napi
  • native_buffer — Enables bindings to native_buffer
  • native_window — Enables bindings to native_window
  • vsync — Enables bindings to native_vsync
  • xcomponent — Enables bindings to native_xcomponent
  • all-components — Enables all components listed above. Orthogonal to api-XX features.

§OpenHarmony API level

This crate by default exposes bindings for API-level 10. Optionally enable one of the api-* features to get access to bindings for newer OpenHarmony versions.

  • api-10 (enabled by default) — No effect. API-10 bindings can’t be deselected. The feature exists for internal purposes.
  • api-11 — Enables bindings for OpenHarmony API-level 11
  • api-12EXPERIMENTAL: Enables bindings for OpenHarmony API-level 12 (beta-1). Will stabilize once the final version has been released.
  • document-features — Document available features when building the documentation

Modules§