/Gy(启用函数级链接)/Gy (Enable Function-Level Linking)

允许编译器以打包函数 (COMDAT) 形式对各个函数进行打包。Allows the compiler to package individual functions in the form of packaged functions (COMDATs).

语法Syntax

/Gy[-]

备注Remarks

链接器需要函数进行单独打包为 Comdat 中排除或 DLL 或.exe 文件中的各个函数进行排序。The linker requires that functions be packaged separately as COMDATs to exclude or order individual functions in a DLL or .exe file.

可以使用链接器选项/OPT (优化)以从.exe 文件中排除未引用的封装的函数。You can use the linker option /OPT (Optimizations) to exclude unreferenced packaged functions from the .exe file.

可以使用链接器选项/ORDER (按顺序放置函数)将封装的函数包括.exe 文件中指定的顺序。You can use the linker option /ORDER (Put Functions in Order) to include packaged functions in a specified order in the .exe file.

如果实例化为调用内联函数则始终打包 (其中发生,例如,如果内联已关闭或采用函数地址)。Inline functions are always packaged if they are instantiated as calls (which occurs, for example, if inlining is off or you take a function address). 此外,自动打包在类声明中定义的 c + + 成员函数;其他函数是不是,并选择此选项所需将其编译为封装函数。In addition, C++ member functions defined in the class declaration are automatically packaged; other functions are not, and selecting this option is required to compile them as packaged functions.

备注

/ZI选项,用于编辑并继续,将自动设置 /Gy选项。The /ZI option, used for Edit and Continue, automatically sets the /Gy option.

在 Visual Studio 开发环境中设置此编译器选项To set this compiler option in the Visual Studio development environment

  1. 打开项目的“属性页” 对话框。Open the project's Property Pages dialog box. 有关详细信息,请参阅使用项目属性For details, see Working with Project Properties.

  2. 单击 “C/C++” 文件夹。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 Also

编译器选项Compiler Options
设置编译器选项Setting Compiler Options