Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust: FFI(Foreign function interface) #355

Open
3 tasks done
Tracked by #361 ...
hhstore opened this issue Jun 5, 2022 · 5 comments
Open
3 tasks done
Tracked by #361 ...

Rust: FFI(Foreign function interface) #355

hhstore opened this issue Jun 5, 2022 · 5 comments

Comments

@hhstore
Copy link
Owner

hhstore commented Jun 5, 2022

@hhstore
Copy link
Owner Author

hhstore commented Jun 5, 2022

Rust + FFI 绑定 core lib 给其他语言调用:

  • Rust 是非常非常适合做 core lib 层的跨平台方案.
  • Flutter 适合 UI 层(交互层) 的跨平台方案.
  • Rust + Flutter 是非常完美的架构组合方案, 兼顾效率和性能.
  • FFI

Rust + FFI 方案:

搜索包:

1. 💎💎💎 主调方(as Caller): Rust call C/C++

  • 调用方: 调用其他语言, call others.

tools:

示例参考项目:

👿👿👿👿 Mac M1 兼容性问题:

教程:

2. 💎💎💎 被调方(as Callee): C/C++ call Rust

  • 被调方: 被其他语言调用, as core lib for others.

tools:

教程:

3. 💎💎💎 双向桥: rust vs c++

4. 其他:

@hhstore
Copy link
Owner Author

hhstore commented Jun 5, 2022

@hhstore
Copy link
Owner Author

hhstore commented Jun 5, 2022

Rust + FFI + Java(JNI):

@hhstore
Copy link
Owner Author

hhstore commented Jun 5, 2022

Rust FFI (被调方):

工具链: cbindgen

参考:

# 安装: 
cargo install --force cbindgen


# 生成: 
cbindgen --config cbindgen.toml --crate my_rust_library --output my_header.h

@hhstore
Copy link
Owner Author

hhstore commented Jun 5, 2022

Rust + FFI + Mac M1 问题:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant