Share via


/Gy   (Enable Function-Level Linking)

OverviewHow Do ICompiler Options

This option allows the compiler to package individual functions in the form of packaged functions (COMDATs). The linker requires that functions be packaged separately as COMDATs to exclude or order individual functions in a DLL or .EXE file. (To find this option in the development environment, click Settings on the Project menu. Then click the C/C++ tab, and click Customize in the Category box.)

You can use the linker’s /OPT:REF option to exclude unreferenced packaged functions from the .EXE file. For more information, see /OPT:REF. You can use the linker’s /ORDER option to place packaged functions in a specified order in the .EXE file. For more information, see /ORDER.

Inline functions are always packaged if they are instantiated as calls (for example, if inlining is turned off, or you take a function address). In addition, C++ member functions defined within the class declaration are automatically packaged; other functions are not, and selecting this option is required to compile them as packaged functions.