次の方法で共有


IVsCoTaskMemFreeMyStrings Interface

Definition

Used in association with certain other interfaces to indicate that strings returned from those interfaces should be freed by the caller.

public interface class IVsCoTaskMemFreeMyStrings
public interface class IVsCoTaskMemFreeMyStrings
__interface IVsCoTaskMemFreeMyStrings
[System.Runtime.InteropServices.Guid("47811DA4-330F-4EB5-9D14-BBC82773DA66")]
[System.Runtime.InteropServices.InterfaceType(1)]
public interface IVsCoTaskMemFreeMyStrings
[<System.Runtime.InteropServices.Guid("47811DA4-330F-4EB5-9D14-BBC82773DA66")>]
[<System.Runtime.InteropServices.InterfaceType(1)>]
type IVsCoTaskMemFreeMyStrings = interface
Public Interface IVsCoTaskMemFreeMyStrings
Attributes

Remarks

Normal COM rules require that any string passed back to a caller should be a copy of the string that the caller eventually disposes of. In other words, the caller is given ownership of the string and can dispose of the string when the caller sees fit.

Some interfaces in the Visual Studio extensibility space do not adhere to this rule of passing ownership to the caller for performance reasons. The callers of those special interfaces understand this change in the rule and do not attempt to dispose of the string. However in managed code, the parameter declarations for returned strings in those special interfaces imply always passing ownership of the string to the caller.

Managed code should implement the IVsCoTaskMemFreeMyStrings interface on those specific interfaces to indicate that the string really should be freed by the caller; otherwise, the caller does not free the string.

Notes to Implementers

Implement this interface on the same interfaces that contain the following methods. Implementing this interface indicates that the string returned from the following methods is to be disposed of by the caller; otherwise, the string is not disposed of.

Notes to Callers

If you have unmanaged code calling into managed code to one of the methods in the list shown in the Notes for Implementers section, call the QueryInterface method on the interface that contains the method to obtain the IVsCoTaskMemFreeMyStrings interface. If the IVsCoTaskMemFreeMyStrings interface can be obtained, you are responsible for freeing the string by calling the FreeCoTaskMem function (not the SysFreeString function). If you cannot obtain the IVsCoTaskMemFreeMyStrings interface, do not attempt to free the returned string.

Applies to