Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

dual

Places an interface in the .idl file as a dual interface.

[dual]

When the dual C++ attribute precedes an interface, it causes the interface to be placed inside the library block in the generated .idl file.

The following code is an attribute block that uses dual before an interface definition:

// cpp_attr_ref_dual.cpp
// compile with: /LD
#include <windows.h>
[module(name="MyLibrary")];

[uuid("2F5F63F1-16DA-11d2-9E7B-00C04FB926DA"), dual]

__interface IStatic : IDispatch 
{
   HRESULT Func1(int i);
   [   propget, 
      id(1), 
      bindable, 
      displaybind, 
      defaultbind, 
      requestedit
   ] 
   HRESULT P1([out, retval] long *nSize);
   [   propput, 
      id(1), 
      bindable, 
      displaybind, 
      defaultbind, 
      requestedit
   ] 
   HRESULT P1([in] long nSize);    
};

[cpp_quote("#include file.h")];

Attribute Context

Applies to

interface

Repeatable

No

Required attributes

None

Invalid attributes

dispinterface

For more information, see Attribute Contexts.

Community Additions

ADD
Show:
© 2015 Microsoft