Share via


/OPT (Windows CE 5.0)

Send Feedback

/OPT controls the optimizations that LINK performs during a build.

/OPT:REF | NOREF
/OPT:ICF[,iterations] | NOICF
/OPT:WIN98 | NOWIN98

Remarks

Optimizations generally decrease the image size and increase the program speed, at a cost of increased link time.

  • REF | NOREF

    /OPT:REF eliminates functions or data that are never referenced while /OPT:NOREF keeps functions or data that are never referenced. /OPT:REF is the default.

    LINK removes unreferenced packaged functions by default. 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 the 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.

    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 activate the /OPT:REF option.

    ICF[,iterations] | NOICF 
    
  • Use /OPT:ICF[,iterations] to perform identical COMDAT folding. Redundant COMDATs can be removed from the linker output. iterations specifies the number of times to traverse the symbols for duplicates. The default number of iterations is two. Additional iterations may locate more duplicates uncovered through folding in the previous iteration.

    ICF is on by default if REF is on and needs to be explicitly turned on in a debug build.

    /OPT:WIN98 | NOWIN98 
    

See Also

Linker Options

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.