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

Full Pointers

· 52CE 我爱测

Unlike unique pointers, full pointers support aliasing.

Unlike unique pointers, full pointers support aliasing. This means that multiple pointers can refer to the same data, as shown in the following figure:

two pointers referencing the same data

A full pointer has the following characteristics:

  • It can have the value null.
  • It can change from null to non-null during the call. When the value changes to non-null, the client stub allocates new memory allocated on return. The client program should free this memory before it terminates.
  • It can change from non-null to null during the call. When the value changes to null, the application is responsible for freeing the memory.
  • The value can change from one non-null value to another.
  • The storage that a full pointer points to may be accessed by another pointer or name in the operation.
  • Return data is written into existing storage if the pointer does not have the value null.

Use the [ ptr ] attribute to specify a full pointer, as shown in the following example:

/* IDL file */
[ 
  uuid(ba209999-0c6c-11d2-97cf-00c04f8eea45),
  version(1.0)
]
interface FullPtrInterface
{
  void RemoteFn([in,ptr,string]) char *ptrName1,
                [in,ptr,string]  char *ptrName2);
}

In this example the parameters ptrName1 and ptrName2 are defined as full pointers to a string. It is possible for both pointers to point to the same memory address containing a single string.

[ptr] is required when providing aliasing support. However, since it requires the most processing of all the pointers available in RPC, it is not recommended for most applications.

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)

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

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