不用,[out] 形式返回的 BSTR 由被调用者分配,由调用者释放,VBScript 当然会做到这一点。
下面是 MSDN Online 上面的《Understanding Strings In COM》的说明:Basic strings must be allocated and freed manually. But who has the responsibility of doing so when function calls are involved? This is a general COM question and so the answer does not apply solely to strings. If the parameter is input-only (IDL attribute [in]) the caller is responsible for both the creation and the destruction of the variable. If the parameter is output-only (IDL attribute [out]) then the callee is responsible for the allocation of the string, but the caller is expected to free it after use. If the parameter is both input and output (IDL attribute [in, out]) then the caller allocates the string and after the method invocation frees the memory. The callee though is allowed to reallocate the string if necessary to do so before returning it to the caller. http://www.devx.com/free/mgznarch/vcdj/1998/dec98/comstring3.asp