Events
May 19, 6 PM - May 23, 12 AM
Calling all developers, creators, and AI innovators to join us in Seattle @Microsoft Build May 19-22.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Pointers are not required to have an explicit attribute description. When an explicit attribute is not provided, the MIDL Compiler uses a default pointer attribute.
The default cases for unattributed pointers are the following:
When a remote procedure returns a pointer, the return value must be a [ unique ] or full ([ ptr ]) pointer.
/* IDL file compiled without /osf */
[
uuid(ba209999-0c6c-11d2-97cf-00c04f8eea45),
version(1.0),
pointer_default(ptr)
]
interface MyInterface
{
typedef long *PLONG;
struct MyCircularList {
struct MyCircularList *pRight;
struct MyCircularList *pLeft;
long Data;
};
void Foo1( [in] PLONG p ); // p is ref
void Foo2( [in] struct MyCircularList *p ); // p is ref, p->pRight and p->pLeft is ptr
struct MyCircularList *Foo3( void ); // returned pointer is ptr.
}
[
uuid(ba209999-0c6c-11d2-97cf-00c04f8eea46),
version(1.0)
]
interface MyInterface2
{
struct MySingleList
{
struct MySingleList *pNext;
long Data;
};
void Foo4( [in] struct MySingleList *p ); // p is ref, p->pNext is unique
struct MySingleList *Foo5( void ); // returned pointer is unique.
}
To ensure unambiguous pointer-attribute behavior, always use explicit pointer attributes when defining a pointer.
It is recommended that [ptr] is used only when pointer aliasing is required.
Events
May 19, 6 PM - May 23, 12 AM
Calling all developers, creators, and AI innovators to join us in Seattle @Microsoft Build May 19-22.
Register today