wdv4758h / notes

let me know if my notes help you :D (it's a mess, I know)
https://wdv4758h.github.io/notes/
142 stars 17 forks source link

Rust and other languages #69

Open wdv4758h opened 7 years ago

wdv4758h commented 7 years ago

以下紀錄 Rust 與其他程式語言間的互動,主要可以分成兩項:

對於 Rust 使用 C 程式碼,基本上就是用 extern 並定義好對應的函式名稱和型別。 對於 C 使用 Rust 程式碼,基本上就是用 Rust 這邊要用 #[no_mangle] 避免函式名稱的 mangling,並且界面要是針對 C 的型別。

雖然我有嘗試寫過 Rust 提供給 C 和 Python 使用,但是覺得手寫起來不太方便,目前有些看起來可能可以幫上忙,但還沒嘗試。

Python 這邊希望可以像 Cython 一樣提供比較方便的方式在 Setup Script 中使用,以便在專案中加入部份的 Rust 程式碼或是連結特定的 library,不知道這樣是否會運作良好。

相關資源:

相關專案:

相關文章: