Files
zhangyu 22b33dcb01 Stackless revert part3 WFC/awaitsync
revert all awaitSync to WaitForCompletion

Issue: https://gitcode.com/openharmony/arkcompiler_runtime_core/issues/11910

Co-Authored-By: Agent

Signed-off-by: zhangyu <zhangyu990@huawei.com>
2026-07-22 17:17:14 +08:00
..
2025-12-13 16:29:09 +08:00
2025-12-13 16:29:09 +08:00
2025-12-13 16:29:09 +08:00
2025-12-13 16:29:09 +08:00
2025-12-13 16:29:09 +08:00
2025-12-13 16:29:09 +08:00
2025-12-25 19:04:57 +08:00
2025-12-13 16:29:09 +08:00
2026-01-26 15:35:56 +08:00

Taihe: 多语言系统接口编程模型

Taihe 是什么

Taihe 提供了简单易用的 API 发布和消费机制。

对于 API 发布方,Taihe 可以轻松地描述要发布的接口。

// idl/integer.arithmetic.taihe

struct DivModResult {
    quo: i32;
    rem: i32;
}

function divmod_i32(a: i32, b: i32): DivModResult;

对于 API 的发布和消费方,Taihe 生成各语言的绑定,提供原生的开发体验。

// 发布 API 为 libinteger.so,源码位于 author/integer.arithmetic.impl.cpp

#include "integer.arithmetic.impl.hpp"

integer::arithmetic::DivModResult ohos_int_divmod(int32_t a, int32_t b) {
  return {
      .quo = a / b,
      .rem = a % b,
  };
}

TH_EXPORT_CPP_API_divmod_i32(ohos_int_divmod)

Taihe 将 API 的发布方和消费方在二进制级别隔离,允许二者在闭源的情况下独立升级。

// 使用 libinteger.so 编写用户应用

#include "integer.arithmetic.abi.hpp"
#include <cstdio>

using namespace integer;

int main() {
  auto [quo, rem] = arithmetic::divmod_i32(a, b);
  printf("q=%d r=%d\n", quo, rem);
  return 0;
}

用户指南

关于 ANI 开发的更多教程可以参考 Taihe ANI CookBook.

开发指南