The wire_marshal attribute
typedef [wire_marshal( transmissible_type)] type_specifier user_type;
This attribute is a type attribute used in the IDL file and is somewhat similar in syntax and semantic to the transmit_as attribute. Each user-specific type has a corresponding transmissible type that defines the wire representation.
The user can define his specific type quite freely, (simple types, pointer types and composite types may be used) although some restrictions apply. The main one is that the type object needs to have well defined (fixed) memory size. If the changeable size needs to be accommodated, the type should have a pointer field as opposed to a conformant array; or it can be a pointer to the interesting type. General restrictions apply as usual. Specific restrictions related to embedding affect the way types can be specified. For more information see the "User type vs. wire type" section.
The [wire_marshal] attribute cannot be used with [allocate()] attribute (directly or indirectly) as the engine doesn't control the memory allocation for the type. Also the wire type cannot be an interface pointer (these may be marshaled directly) or a full pointer (we cannot take care of the aliasing).
The following is a list of additional points regarding wire_marshal:
- The wire type cannot be an interface pointer.
- The wire type cannot be a full pointer.
- The wire type cannot have allocate attribute on it (like [allocate(all_nodes)]).
- The wire type has to have a well-defined memory size (cannot be a conformant structure, for example) as we allocate the top-level object for the user as usual.
- When the engine delegates responsibility for a wire_marshalable type to the user supplied routines, everything is up to the user including servicing of the possible embedded types that are defined with wire_marshal, user_marshal, transmit_as and so forth.
- wire_marshal is mutually exclusive with user_marshal, transmit_as or represent_as when applied to the same type.
- Two different user types cannot resolve to the same wire type and vice versa.
- The user type may or may not be RPC-able.
- The user type must be known to MIDL.