Home | Overview | How Do I | Linker Options
/OPT:{REF|NOREF|ICF[,iterations]|NOICF}
This option controls the optimizations that LINK performs during a build. Optimizations generally decrease the image size and increase the program speed, at a cost of increased link time.
By default, LINK removes unreferenced packaged functions. An object contains packaged functions (COMDATs) if it has been compiled with the /Gy option. This optimization is called transitive COMDAT elimination. To override this default and keep unreferenced COMDATs in the program, specify /OPT:NOREF. You can use the /INCLUDE option to override the removal of a specific symbol.
If /OPT:REF is specified, /OPT:ICF is on by default. If you want /OPT:REF but not /OPT:ICF, you must specify the following:
link /opt:ref /opt:noicf
Specifying /OPT:ICF does not turn on the /OPT:REF option.
If the /DEBUG option is specified, the default for /OPT changes from REF to NOREF, and all functions are preserved in the image. To override this default and optimize a debugging build, specify /OPT:REF. The /OPT:REF option disables incremental linking.