# Interfacing rust?

**URL:** <https://discourse.julialang.org/t/interfacing-rust/6389>\
**Category:** General Usage\
**Tags:** rust\
**Created:** [October 11, 2017, 2:38pm UTC](https://discourse.julialang.org/t/interfacing-rust/6389 "2017-10-11T14:38:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lobingera](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lobingera/32/211_2.png) [@lobingera](https://discourse.julialang.org/u/lobingera)\
**Post date:** [October 11, 2017, 2:38pm UTC](https://discourse.julialang.org/t/interfacing-rust/6389/1 "2017-10-11T14:38:19Z")

</div>

Is there any documentation/example available to interface to rust? Like in ccall?

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [October 11, 2017, 2:57pm UTC](https://discourse.julialang.org/t/interfacing-rust/6389/2 "2017-10-11T14:57:37Z")

</div>

I haven’t personally tried this, but I know Rust can be told to generate non-mangled externally-callable functions in a shared library: [Rust Inside Other Languages](https://doc.rust-lang.org/1.5.0/book/rust-inside-other-languages.html#a-rust-library). It should be possible to call a function from that shared library using `ccall` just like you would with a C library.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [October 11, 2017, 4:06pm UTC](https://discourse.julialang.org/t/interfacing-rust/6389/3 "2017-10-11T16:06:17Z")

</div>

> **[GitHub - iamed2/Rust.jl: Write Rust code in Julia](https://github.com/iamed2/Rust.jl)**
>
> Write Rust code in Julia. Contribute to iamed2/Rust.jl development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![iamed2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iamed2/32/215082_2.png) [@iamed2](https://discourse.julialang.org/u/iamed2)\
**Post date:** [October 11, 2017, 8:52pm UTC](https://discourse.julialang.org/t/interfacing-rust/6389/4 "2017-10-11T20:52:47Z")

</div>

I think @Rory-Finnegan was working on improving that but I don’t know if he pushed anything.

---

<div class="post-metadata">

**Author:** ![Rory-Finnegan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rory-finnegan/32/226_2.png) [@Rory-Finnegan](https://discourse.julialang.org/u/Rory-Finnegan)\
**Post date:** [October 11, 2017, 9:23pm UTC](https://discourse.julialang.org/t/interfacing-rust/6389/5 "2017-10-11T21:23:55Z")

</div>

Yeah, but I gave up when I realized that `LambdaInfo` was removed in 0.6 and wasn’t clear what the work around should be.

---

<div class="post-metadata">

**Author:** ![fabiangans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fabiangans/32/2624_2.png) [@fabiangans](https://discourse.julialang.org/u/fabiangans)\
**Post date:** [October 12, 2017, 6:59am UTC](https://discourse.julialang.org/t/interfacing-rust/6389/6 "2017-10-12T06:59:50Z")

</div>

In a recent larger project I have successfully used the path that @rdeits pointed to.The interfacing works smoothly, including passing of structs between rust and julia.

Unfortunately the code is currently not in a public repository, but if you have trouble with a specific step, feel free to ask.

I also tried to auto-generate C header files from my rust interface which could then be wrapped using Clang.jl, but did not succeed. So in the end I hand-coded the ccalls directly.

> **[rusty-binder / rusty-binder · GitLab](https://gitlab.com/rusty-binder/rusty-binder)**
>
> 📁 Create Rust bindings for any language! https://rusty-binder.gitlab.io/rusty-binder/

> **[GitHub - Sean1708/rusty-cheddar: A Rust crate for automatically generating C...](https://github.com/Sean1708/rusty-cheddar)**
>
> A Rust crate for automatically generating C header files from Rust source file. - GitHub - Sean1708/rusty-cheddar: A Rust crate for automatically generating C header files from Rust source file.

---

<div class="post-metadata">

**Author:** ![felipenoris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/felipenoris/32/553_2.png) [@felipenoris](https://discourse.julialang.org/u/felipenoris)\
**Post date:** [September 25, 2018, 2:13pm UTC](https://discourse.julialang.org/t/interfacing-rust/6389/7 "2018-09-25T14:13:06Z")

</div>

Please, check out [[ANN] Embedding Rust Library in a Julia Package](https://discourse.julialang.org/t/ann-rust-library-embedded-in-a-julia-package/15470).
