Listing 3 Using the MIDL cpp_quote keyword
typedef struct SOMESTRUCT { int i; short s; } SOMESTRUCT; cpp_quote("#ifndef __cplusplus") typedef SOMESTRUCT *SOMESTRUCT_ref_t; cpp_quote("#else") cpp_quote("typedef SOMESTRUCT &SOMESTRUCT_ref_t;") cpp_quote("#endif /* !__cplusplus */") interface IOther { HRESULT TellSOMESTRUCT([in] int i, [in] short s); } cpp_quote("#ifndef __cplusplus") typedef IOther *IOther_ref_t; cpp_quote("#else") cpp_quote("typedef IOther &IOther_ref_t;") cpp_quote("#endif /* !__cplusplus */") interface IInterface { HRESULT NonNullMethod( [in, ref] SOMESTRUCT_ref_t pss, [in] IOther_ref_t pii2); }