TypeDef Syntax for Complex Data Types

In MIDL, the first definition will generate a TKIND_RECORD for "myStruct" and a TKIND_ALIAS for "testStruct" (defining "testStruct" as an alias for "myStruct"). For the second definition, MIDL will generate a TKIND_RECORD for a mangled name internal to MIDL that is not meaningful to the user and a TKIND_ALIAS for "testStruct".

typedef struct myStruct  { ... } testStruct;
typedef struct { ... } testStruct;

This has potential implications for type library browsers that simply show the name of a record in its user interface. If you expect a TKIND_RECORD to have a real name, there is a potential for unrecognizable names to appear in the user interface. This behavior also applies to union and enum definitions, with the MIDL compiler generating TKIND_UNIONs and TKIND_ENUMs, respectively.

MIDL also allows C-style struct, union and enum definitions. For example, the following definition is legal in MIDL:

struct myStruct { ... };
typedef struct myStruct testStruct;