|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
/Fx (Merge Injected Code)
/Fx produces a copy of each source file with injected code merged into the source.
To distinguish a merged source file from an original source file, /Fx adds an .mrg extension between the file name and file extension. For example, a file named MyCode.cpp containing attributed code and built with /Fx creates a file named MyCode.mrg.cpp containing the following code:
//+++ Start Injected Code [no_injected_text(true)]; // Suppress injected text, it has already been injected #pragma warning(disable: 4543) // Suppress warnings about skipping injected text #pragma warning(disable: 4199) // Suppress warnings from attribute providers //--- End Injected Code
In an .mrg file, code that was injected because of an attribute will be delimited as follows:
//+++ Start Injected Code ... //--- End Injected Code
The no_injected_text attribute is embedded in an .mrg file, which allows for the compilation of the .mrg file without text being reinjected.
You should be aware that the .mrg source file is intended to be a representation of the source code injected by the compiler. The .mrg file may not compile or run exactly as the original source file.
Macros are not expanded in the .mrg file.
If your program includes a header file that uses injected code, /Fx generates an .mrg.h file for that header. /Fx does not merge include files that do not use injected code.
To set this compiler option in the Visual Studio development environment
- Open the project's Property Pages dialog box. For details, see Setting Visual C++ Project Properties.
- Click the C/C++ folder.
- Click the Output Files property page.
- Modify the Expand Attributed Source property.
To set this compiler option programmatically