These are chat archives for
Sign in to start talking
a safe, concurrent, practical language
Mar 24 2017 00:35
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
for that purpose.
Mar 24 2017 02:36
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
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)
I've definitely used that for callbacks: