These are chat archives for rust-lang/rust

24th
Mar 2017
Jacob Kiesel
@Xaeroxe
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
@pthariensflame
Mar 24 2017 01:26
Or use libc::c_void for that purpose.
Peter Atashian
@retep998
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
@dhylands
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)