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
我的问题是,BSTR
s 的行为是否正确,我们是否需要在第一次调用后保存newX_x
一些新的?BSTR
functionA
或者functionA
它可能是错误地分配/取消分配传递BSTR
的 s.