These are chat archives for rust-lang/rust

Mar 2017
Jacob Kiesel
Mar 24 2017 00:35
@tjayrush Void pointers go against everything the Rust language exists to guarantee. That being said, you could just use a raw pointer to a u8 and transmute that into whatever you need it to be.
Alexander Ronald Altman
Mar 24 2017 01:26
Or use libc::c_void for that purpose.
Peter Atashian
Mar 24 2017 02:36
@tjayrush I've done a lot of winapi stuff, which is basically a ton of unsafe FFI with C, including function pointers and callbacks, and it's all worked just fine.
There's a few things that are still tricky, like unions aren't stable yet, and there's still no way to manually specify alignment/packing, and no builtin bitfields, but for the most part it's fine
Dave Hylands
Mar 24 2017 19:02
You can also use Option<* mut u8> or whatever pointer type you need, and None maps to the null pointer (in both directions)