The wire_marshal Attribute

The wire_marshal attribute is an IDL type attribute similar in syntax to transmit_as, but provides a more efficient way to marshal data across a network.

You use the wire_marshal attribute to specify a data type that will be transmitted in place of the application-specific data type. Each application-specific type has a corresponding transmissible type that defines the wire representation (the way it is transmitted).The application-specific type need not be remotable, but it must be a type that MIDL recognizes. To marshal a type unknown to MIDL, use the ACF attribute user_marshal.

Your application-specific type can be a simple, composite, or pointer type. The main restriction is that the type object must have a fixed, well-defined memory size. If the size of your type object needs to change, use a pointer field rather than a conformant array. Alternatively, you can define a pointer to the changeable type.

You supply the routines for the sizing, marshaling, unmarshaling and freeing passes. The following table describes the four user-supplied routine names. The <type> is the userm-type specified in the wire_marshal type definition.

Routine Description
<type>_UserSize Sizes the rpc data buffer before marshaling on the client or server side.
<type>_UserMarshal Marshals the data on the client or server side.
<type>_UserUnmarshal Unmarshals the data on the client or server side.
<type>_UserFree Frees the data on the server side.

These user-supplied routines are provided by either the client or the server application based on the directional attributes.

If the parameter is in only, the client transmits to the server. The client needs the <type>_UserSize and <type>_UserMarshal functions. The server needs the <type>_UserUnmarshal and <type>_UserFree functions.

For an out-only parameter, the server transmits to the client. The server needs the <type>_UserSize and <type>_UserMarshal functions, while the client needs the <type>_UserMarshal function.

See Also

The user_marshal Attribute, Marshaling Rules for user_marshal and wire_marshal, wire_marshal, user_marshal