Re:Lock freedom without garbage collection in Rust
by rhelmer on Thursday August 27, 2015 @05:53PM
(#10132380)
What do you feel is rough around FFI? Safer, zero-cost bindings to C libraries - what's not to like? :)
[ Parent
| on HN ]
Re:Lock freedom without garbage collection in Rust
by vvanders on Thursday August 27, 2015 @06:10PM
(#10132466)
CString::from_ptr is unstable - https://doc.rust-lang.org/stable/std/ffi/struct.CString.html
clib is marked as unstable - https://doc.rust-lang.org/stable/libc/types/os/arch/c95/type...
Most of the intrinsic types are usable but anything involving strings seems to hit unstable/experimental branch pretty quickly.
I'm sure it'll improve I was just a bit surprised to not see it mentioned in the docs.
Re:Lock freedom without garbage collection in Rust
by steveklabnik on Thursday August 27, 2015 @06:12PM
(#10132481)
You should use libc from crates.io, which is stable. Not the compiler-internal one you linked to.
Re:Lock freedom without garbage collection in Rust
by vvanders on Thursday August 27, 2015 @06:30PM
(#10132574)
Ah, the docs around FFI say that libc is a part of the standard library so it wasn't clear that I'd have to pull that from crates.io.
Re:Lock freedom without garbage collection in Rust
by steveklabnik on Thursday August 27, 2015 @06:57PM
(#10132676)
Hmm, can you point me to where they say that so I can fix it? Seems bad.
(Also, the error message when you don't have a `#![feature(libc)]` should say "hey, please use the external crate thanks")
Re:Lock freedom without garbage collection in Rust
by vvanders on Thursday August 27, 2015 @07:17PM
(#10132745)
https://doc.rust-lang.org/book/ffi.html at the end of "Interoperability with foreign code"
Yeah, that error message sent me down the wrong path :).
Re:Lock freedom without garbage collection in Rust
by steveklabnik on Thursday August 27, 2015 @07:42PM
(#10132851)
Ahh excellent, thank you! https://github.com/rust-lang/rust/issues/28053
Re:Lock freedom without garbage collection in Rust
by vvanders on Thursday August 27, 2015 @08:02PM
(#10132931)
Nice!
Let me add another plus for Rust is the community around it.
Re:Lock freedom without garbage collection in Rust
by tatterdemalion on Thursday August 27, 2015 @06:54PM
(#10132667)
Yeah its unfortunate that the some FFI APIs are still marked unstable, but Rust is still a language with memory safety, no garbage collector, and opt-in to a C-compatible ABI. That's a pretty big deal in my opinion!
Re:Lock freedom without garbage collection in Rust
by CyberDildonics on Thursday August 27, 2015 @07:49PM
(#10132873)
You just repeated exactly what the OP was saying.