Thanks @IInspectable!
This comment solved what I wanted to know.
This Microsoft implementation of how to receive strings allocated by the OS is the answer I am looking for.
In addition, the knowledge that I don't have to call FormatMessageW
myself to display error messages was a big bonus.
(I probably should have noticed that the stderror was displayed in double place at the eprintln!("{:?}", err_msg);
location and the Err(er)
location in the main
function.)