### /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:

- Not referenced anywhere in the object code
- Rendered unreferenced by the removal of other functions
- Not exported for use in other files.

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