次の方法で共有


IMarshal::ReleaseMarshalData (Compact 2013)

3/26/2014

This method destroys a marshaled data packet.

Syntax

HRESULT ReleaseMarshalData(
  IStream* pStm 
);

Parameters

  • pStm
    [in] Pointer to a stream that contains the data packet to be destroyed.

Return Value

The method supports the standard return value E_FAIL, as well as the following:

  • S_OK
    The data packet was released.
  • IStreamerrors
    This function can also return any of the stream-access error values for the IStream interface.

Remarks

If an object's marshaled data packet does not get unmarshaled in the client process space, and the packet is no longer needed.

The client calls ReleaseMarshalData on the proxy's IMarshal implementation to instruct the object to destroy the data packet. The call occurs within the CoReleaseMarshalData function.

The data packet serves as an additional reference on the object, and releasing the data is like releasing an interface pointer by calling Release.

If the marshaled data packet somehow does not arrive in the client process, or ReleaseMarshalData is not recreated in the proxy, COM can call this method on the object itself.

To determine whether the platform supports this interface, see Determining Supported COM APIs.

Notes to Callers

You rarely have occasion to call this method yourself.

A possible exception is if you implement IMarshal on a class factory for a class object that you are also implementing IMarshal on.

In this case, if you are marshaling the object to a table, where it can be retrieved by multiple clients, you might, as part of your unmarshaling routine, call ReleaseMarshalData to release the data packet for each proxy.

Notes to Implementers

If your implementation stores state information about marshaled data packets, you can use this method to release the state information associated with the data packet represented by pStm. Your implementation should also position the seek pointer in the stream past the last byte of data.

Requirements

Header

objidl.h,
objidl.idl

Library

ole32.lib,
uuid.lib

See Also

Reference

IMarshal
CoUnmarshalInterface
CoReleaseMarshalData