docs

#E0025: 不支持的 ABI

extern 指定了 Nabi 不支持的 ABI,或者没有指定 ABI。写 extern "C"(平台的系统调用则写 "system")。

nabi
extern "fastcall" {
    fn abs(x: i32) -> i32;
}
error[E0025]: unsupported ABI `"fastcall"` (`"C"`, `"system"`, `"objc"`, or `"nabi"` for the runtime)
  --> main.nabi:1:1
   |
 1 | extern "fastcall" {
   | ^^^^^^

写 "C":

nabi
extern "C" {
    fn abs(x: i32) -> i32;
}
println(f"{unsafe { abs(-3) }}");
3

相关错误码:E0084 无效的外部函数用法

发现错误? 在 GitHub 上编辑此页 最后更新: