hhstore / blog

My Tech Blog: about Mojo / Rust / Golang / Python / Kotlin / Flutter / VueJS / Blockchain etc.
https://github.com/hhstore/blog/issues
294 stars 24 forks source link

Rust FFI: XXX Call Rust & Rust Call XXX #355

Open hhstore opened 2 years ago

hhstore commented 2 years ago

📖 Abstract:

💯 Related:

hhstore commented 2 years ago

Rust + FFI 方案

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

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

3. 双向桥: rust vs c++

4. 其他:

参考:

搜索包:

hhstore commented 2 years ago

Rust FFI: C/C++ Call Rust

🔥 工具链:

uniffi-rs

cbindgen

其他

🔥 示例项目:

sled-native

💡 参考:


# 安装: 
cargo install --force cbindgen

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

教程:

hhstore commented 2 years ago

Rust FFI: XXX Call Rust

hhstore commented 2 years ago

Rust FFI: Rust Call C/C++

工具链:

示例参考项目:

👿 Mac M1 兼容性问题:

教程:

hhstore commented 2 years ago

Rust FFI: Flutter Call Rust

🔥 工具链

🔥 典型案例:

一个漫画阅读器:

hhstore commented 1 month ago

Rust + FFI + Java(JNI):

hhstore commented 1 month ago

Rust + FFI + Mac M1 问题:

hhstore commented 1 month ago

1

hhstore commented 1 month ago

1