ooooh "&mut (some_ptr as *const c_void)" actually produces a different address than &some_ptr!! wow that took a long time to debug. still don't fully understand why. #rustlang FFI is particularly challenging for a newcomer.
-
Show this thread
-
all I want to do is pass "&some_ptr" (address of a "*const SomeStructure") to a C function that takes a "void **" and updates "some_ptr" to point to a thing allocated by the C function.
1 reply 0 retweets 0 likesShow this thread -
looks like std::mem::transmute is what I want here
2 replies 0 retweets 0 likesShow this thread -
-
Replying to @rustlang
*const SomeStructure (initialized to ptr::null()). The C function sets the ptr to different types of values depending on another arg (which is why it takes void**). In this case I know it will set it to a SomeStructure (not my API, btw)
3 replies 0 retweets 0 likes
Cool, as long as it’s not an &, or that’d be UB. I’m not totally sure why the address changes... anyway yeah you started at the hard part :)
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.