Interfacing rust?

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

2 Likes

I haven’t personally tried this, but I know Rust can be told to generate non-mangled externally-callable functions in a shared library: 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.

3 Likes
3 Likes

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

1 Like

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.

1 Like

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.

2 Likes

Please, check out [ANN] Rust Library embedded in a Julia Package.

2 Likes