次の方法で共有


dual

デュアル インターフェイスとしてインターフェイスを .idl ファイルに配置します。

構文

[dual]

解説

dual C++ 属性がインターフェイスの前にあると、インターフェイスは生成される .idl ファイルのライブラリ ブロック内に配置されます。

次のコードは、インターフェイス定義の前に 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")];

必要条件

属性コンテキスト Value
適用対象 interface
反復可能 いいえ
必要な属性 なし
無効な属性 dispinterface

詳細については、「 属性コンテキスト」を参照してください。

関連項目

IDL 属性
使用法別の属性
custom
dispinterface
object
__interface