Creates an object that implements special marshalling behavior. This is a helpler function that makes it easier to define objects with VTBLs that different apartment model threads can access directly.

HRESULT CoCreateFreeThreadedMarshaler(

LPUNKNOWN punkOuter,
//Points to the stream from which the object is to be marshaled
LPUNKNOWN punkMarshaler
//The interface requested from the unmarshaled object



Specifies a pointer to the controlling IUnknown of the object that is going to have the special marshaling behavior specified by the object this function creates.


[out] On return, contains a pointer to the private IUnknown of an object that implements this special marshaling behavior.

Return Values


Indicates the marshaler was created successfully.


Indicates that the marshaler object could not be created.


is a helper API that makes it easier to define an object that allows direct access to its VTBL from multiple apartment-model threads of execution, and uses standard marshaling if a reference to the object is sent to another process.

When there is a request for a pointer to an object, the marshal context of the request is determined by the specified member of the MSHCTX enumeration. When the marshal context is MSHCTX_INPROC, meaning that the pointer to the object need only be marshaled across different threads in the same process, the marshal code only has to copy the pointer to the interface being marshaled into the marshaling stream. For any other marshaling context, use standard marshaling to complete the operation.

CoCreateFreeThreadedMarshaler implements code that defines this context-dependent behavior, and, on return, writes to its punkMarshaler parameter a pointer to the private unknown for a object that does this standard type of marshaling. The function then aggregates this marshaler object with the object that should have this marshaling behavior.

See Also

CoMarshalInterThreadInterfaceInStream, CoGetInterfaceAndReleaseStream

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database