ms_union

カプセル化されていない共用体の、ネットワーク データ表現の整列を制御します。

[ms_union]

解説

C++ 属性 ms_union の機能は、Microsoft インターフェイス定義言語 (MIDL: Microsoft Interface Definition Language) 属性 ms_union と同じです。

使用例

ms_union の配置を次のコード例に示します。

// cpp_attr_ref_ms_union.cpp
// compile with: /LD
#include <unknwn.h>
[object, ms_union, uuid("00000000-0000-0000-0000-000000000001")]
__interface IFireTabCtrl {
   HRESULT DisplayString([in, string] char * p1);
};

[export, switch_type(short)] union _WILLIE_UNION_TYPE  {
   [case(24)]
      float fMays;
   [case(25)]
      double dMcCovey;
   [default]
      int x;
 };

[public] typedef _WILLIE_UNION_TYPE WILLIE_UNION_TYPE;

[module(name="ATLFIRELib")];

必要条件

属性コンテキスト

対象

カプセル化されていない共用体

複数回の適用

不可

必要な属性

なし

無効な属性

dispinterface

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

参照

概念

IDL 属性

Typedef、Enum、Union、および Struct 型の属性

ATL サンプル