What is the Message Compiler and when would it be used?

he manifest that contains the event definitions is compiled by the Message Compiler (MC.exe) tool. The Message Compiler is run before the source files compiler because it produces files required to compile the source files that raise events. It also generates the template and message resources to be added to the binary at link time.

The Message Compiler is included in the Windows SDK The Message Compiler accepts a message file (.mc) as input and generates the following files: a C/C++ header file that contains definitions for the symbolic names, one binary resource file per supported language (Msg00001.bin, Msg00002.bin, and so on), and a resource file (.rc) that contains the appropriate statements to include each .bin file as a resource.
Most manifests will use standard Windows-defined constants and the path to Winmeta.xml file that contains the definitions of these constants must be included. In many cases, this invocation is sufficient. Commonly, -h and –r switches are used to direct output files to the object directory.
The validation of the events, channels, and event attributes declared in the manifest is performed during compilation. This process does not validate the XML against the schema of the instrumentation (instrumentationManifest) section, unless the XSD file that contains such schema is supplied using the –w switch. The Message Compiler always performs a number of semantic checks, such as:
• The channel for every event is declared in channel declaration.
• All admin events have messages and their levels are Warning, Error, or Critical.
• No duplicate event IDs exist in the manifest.

No comments: