cpp_quote attribute

The cpp_quote keyword instructs MIDL to emit the specified string, without the quote characters, into the generated header file.




Specifies a quoted string that is emitted in the generated header file. The string must be quoted to prevent expansion by the C preprocessor.


C-language preprocessing directives that appear in the IDL file are processed by the C compiler's preprocessor. The #define directives in the IDL file are available during MIDL compilation but are not available to the C compiler.

For example, when the preprocessor encounters the directive "#define WINDOWS 4", the preprocessor replaces all occurrences of "WINDOWS" in the IDL file with "4". The symbol "WINDOWS" is not available during C-language compilation.

To allow the C-preprocessor macro definitions to pass through the MIDL compiler to the C compiler, use the #pragma midl_echo or cpp_quote directive. These directives instruct the MIDL compiler to generate a header file that contains the parameter string with the quotation marks removed. The #pragma midl_echo and cpp_quote directives are equivalent.

The MIDL compiler places the strings specified in the cpp_quote and pragma directives into the header file in the sequence in which they are specified in the IDL file, and relative to other interface components in the IDL file. The strings should usually appear in the IDL file interface body section after all import operations.


cpp_quote("#include \"myfile.h\" ")  
cpp_quote("#define UNICODE")

See also

Interface Definition (IDL) File



Community Additions