大网数据广告活动
网络与域名解析

The wire_marshal Attribute

· 52CE 我爱测

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

The [ wire_marshal] attribute is an IDL-type attribute similar in syntax to [ transmit_as], but providing 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 transmittable type that defines the wire representation (the representation used on the network).The application-specific type need not be transmittable, 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 instance must have a fixed, well-defined memory size. If the size of your type instance needs to change, use a pointer field rather than a conformant array. Alternatively, you can define a pointer to the changeable type.

You must supply the routines for sizing, marshaling, and unmarshaling the data as well as freeing the associated memory. 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 programmer-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.

Related topics

The user_marshal Attribute

Marshaling Rules for user_marshal and wire_marshal

wire_marshal

user_marshal

NdrGetUserMarshalInfo

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。