I'm working on something that interacts with LXC and currently I have problems with pointers (This is the first time I've really touched this stuff). Whenever I try turning an array of args (&[&str]) to a vector of pointers (Vec<*const i8>) it always drops them before I can actually use them. The reason is pretty obvious as .as_ptr() tells you, but I cant figure out a way to fix it.
#Make a ptr live longer than the closure for .map()
8 messages · Page 1 of 1 (latest)
the thing that you need to not drop is the CStrings since they are what actually own the null-terminated strings
so, collect the CStrings and then, separately, iterate over that to collect the pointers to them
Wow, thanks