Open EndilWayfare opened 3 years ago
You can, of course, explicitly spell it out in the meantime
pub fn cause_bstr_to_happen() -> winapi::shared::wtypes::BSTR {
let bstr: BStr = "Hello World".into();
let ptr = bstr.as_ptr();
std::mem::forget(bstr);
ptr
}
If you're implementing a function that returns a string to foreign COM callers, you should not deallocate the returned BSTR. Since we can't pass a
wio::BStr
across the boundary, we'd need some way to extract the pointer and make rustforget
about it. I don't see that any existing method would allow that.c.f.
ComPtr