---
name: "CoMarshalInterface"
section: "3w"
platform: "linux"
package: "libwine-dev"
version: "1.4.1-4"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/CoMarshalInterface"
---

# CoMarshalInterface(3w)

## NAME

**CoMarshalInterface** (OLE32.@)

## SYNOPSIS

HRESULT CoMarshalInterface\
  (\
   IStream\*  *pStream*,\
   REFIID    *riid*,\
   IUnknown\* *pUnk*,\
   DWORD     *dwDestContext*,\
   void\*     *pvDestContext*,\
   DWORD     *mshlFlags*\
  )

## DESCRIPTION

Marshals an interface into a stream so that the object can then be unmarshaled from another **COM** apartment and used remotely.

## PARAMS

*pStream* **\[In\]**  Stream the object will be marshaled into.

*riid* **\[In\]**  Identifier of the interface to marshal.

*pUnk* **\[In\]**  Pointer to the object to marshal.

*dwDestContext* **\[In\]**  Destination. Used to enable or disable optimizations.

*pvDestContext* **\[In\]**  Reserved. Must be **NULL**.

*mshlFlags* **\[In\]**  Flags that affect the marshaling. See notes.

## RETURNS

**Success:** **S\_OK**.

**Failure:** **HRESULT** code.

## NOTES

The *mshlFlags* parameter can take one or more of the following flags: \
\
  MSHLFLAGS\_NORMAL - Unmarshal once, releases stub on last proxy release.\
\
  MSHLFLAGS\_TABLESTRONG - Unmarshal many, release when CoReleaseMarshalData() called.\
\
  MSHLFLAGS\_TABLEWEAK - Unmarshal many, releases stub on last proxy release.\
\
  MSHLFLAGS\_NOPING - No automatic garbage collection (and so reduces network traffic).

If a marshaled object is not unmarshaled, then **[CoReleaseMarshalData(3w)](/CoReleaseMarshalData/3w.md)** must be called in order to release the resources used in the marshaling.

## SEE ALSO

CoUnmarshalInterface(), **[CoReleaseMarshalData(3w)](/CoReleaseMarshalData/3w.md)**.

## IMPLEMENTATION

Declared in **"objbase.h"**.

Implemented in **"dlls/ole32/marshal.c"**.

Debug channel **"ole"**.
