/Gl Compiler Option

Syntax: Default:
/Gl[+|-] /Gl-

Use /Gl to remove unreachable functions. The compiler prepares the object code for optimization by the linker, and then passes the /OPTFUNC option to the linker. The linker removes functions that are:

When the function is removed, any additional functions that were required only by that function are also removed. Removing the functions and code reduces the size of your executable or dynamic link library output file.

If you are compiling and linking in separate steps, you must compile with /Gl and then link with /OPTFUNC to perform this optimization.

By default, the linker does not remove unreachable functions.

Performance Consideration: Optimized linking generally takes longer than regular linking. However, if the optimization is effective enough, it can actually speed up the linking process, because there is less information to write to file. Generally, you may want to compile without the /Gl option, until your code is tested and stable.



Summary of Compiler Options