Export (0) Print
Expand All
Expand Minimize

/Gy (Enable Function-Level Linking)

/Gy

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.

You can use the linker option /OPT:REF to exclude unreferenced packaged functions from the .exe file.

You can use the linker option /ORDER to place packaged functions in a specified order within the .exe file.

Inline functions are always packaged if they are instantiated as calls (which occurs, 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.

Note   The /ZI option, used for Edit and Continue, automatically sets the /Gy option.

To set this compiler option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see Setting Visual C++ Project Properties.
  2. Click the C/C++ folder.
  3. Click the Code Generation property page.
  4. Modify the Enable Function-Level Linking property.

To set this compiler option programmatically

See EnableFunctionLevelLinking Property.

See Also

Compiler Options | Setting Compiler Options

Show:
© 2014 Microsoft