Share via


dual

将一个接口作为 dual 接口置于 .idl 文件中。

语法

[dual]

备注

当 dual C++ 属性优先于接口时,会导致将接口置于生成的 .idl 文件中的 library 块中。

示例

以下代码是一个属性块,在接口定义之前使用 dual

// 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")];

要求

特性上下文
适用于 interface
可重复
必需的特性
无效的特性 dispinterface

有关详细信息,请参见 特性上下文

另请参阅

IDL 特性
按用法分的特性
custom
dispinterface
对象
__interface