Article ID: 181651
Article Last Modified on 3/15/2004
typedef enum _MyStructEnum {
MyStructEnum1, MyStructEnum2
} MyStructEnum;
typedef struct _MyStruct1 {
char foo;
} MyStruct1;
typedef struct _MyStruct2 {
long length;
[size_is(length)] char* bytes;
} MyStruct2;
// A union with structs as arms.
typedef [switch_type(MyStructEnum)] union {
[case(MyStructEnum1)] MyStruct1 myStruct1;
[case(MyStructEnum2)] MyStruct2 myStruct2;
} MyUnion;
Change the myUnion field of MyType listed below:
typedef struct _MyType {
long someData;
MyStructEnum whichStruct;
[switch_is(whichStruct)] MyUnion myUnion;
} MyType;
to a pointer to MyUnion as follows:
typedef struct _MyType {
long someData;
MyStructEnum whichStruct;
[switch_is(whichStruct)] MyUnion *myUnion;
} MyType;
Additional query words: Type Encoding Midl union_arms
Keywords: kbbug kbapi kbrpc kbnetwork kbpending KB181651