/Gw (Optimize Global Data)
For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.
Package global data in COMDAT sections for optimization.
The /Gw option causes the compiler to package global data in individual COMDAT sections. By default, /Gw is off and must be explicitly enabled. To explicitly disable it, use /Gw-. When both /Gw and /GL are enabled, the linker uses whole-program optimization to compare COMDAT sections across multiple object files in order to exclude unreferenced global data or to merge identical read-only global data. This can significantly reduce the size of the resulting binary executable.
When you compile and link separately, you can use the /OPT:REF linker option to exclude from the executable the unreferenced global data in object files compiled with the /Gw option.
For more information, see Introducing /Gw Compiler Switch on the Visual C++ Team Blog.
Open the project's Property Pages dialog box. For details, see Working with Project Properties.
Select the C/C++ folder.
Select the Command Line property page.
Modify the Additional Options property to include /Gw and then choose OK.
- See AdditionalOptions.