BSTR newID_x = SysAllocString(L"newID");
BSTR newX_x = SysAllocString(L"newX");
functionA(&newID_x);
//Func A does some operation on newID_x, we have that value in newID_x now
functionA(&newX_x);
//After Func A is called for the second time, both newID_x and newX_x become the same
//i.e, both are pointing to same locations and hence values too
我的问题是,BSTRs 的行为是否正确,我们是否需要在第一次调用后保存newX_x一些新的?BSTRfunctionA
或者functionA它可能是错误地分配/取消分配传递BSTR的 s.