Re:FFI from Go to Rust
by burntsushi on Saturday May 09, 2015 @04:01PM
(#9517501)
> (Careful, it will not compile with rust 1.0 beta (use of unstable library feature 'libc'))
FYI, `libc` is on crates.io: https://crates.io/crates/libc
Just add `libc` as a dependency in your `Cargo.toml` and you should be good to go on beta (assuming that was the only thing holding you back).
I implemented a similar experiment with Haskell and Rust[0]. It does some simple math and also passes a Haskell callback function into Rust code. Unfortunately, I think we lose quite a bit of information by passing through C code (e.g. Rust's parametric polymorphism).
[0] - https://github.com/creichert/haskellrustdemo (Careful, it will not compile with rust 1.0 beta (use of unstable library feature 'libc')).