### /OPTVFUNC[TION] Linker Option - Inactive Option

Syntax: | Default:
/OPTVFUNCTION | /NOOPTVFUNCTION
/NOOPTVFUNCTION |

/OPTVFUNCTION is not active in the current version of IBM C and C++ Compilers.

The option is intended to remove unreferenced virtual functions.

When you link using the /OPTVFUNCTION option, the linker removes those functions that are never referenced. If a virtual function is always clearly overridden by a function of a derived class, the function is removed.

Since many class libraries contain extensive cross-referencing within their virtual functions, a minimal program can end up linking in most of the class library. When the linker removes the unreferenced virtual functions, it also removes any code or additional functions referenced by the virtual functions, reducing the size of the output file.

Note: You must use a VisualAge for C++ compiler from version 3.0 or later, or use IBM C and C++ Compilers to generate the object files you link. The linker cannot perform this optimization on object code created by older versions of the compiler.

Removing virtual functions can cause problems if you are using or generating a dynamic link library:

- If your program links to a DLL when it runs, the DLL may need a virtual function that the linker has removed. Unless you are sure this will not happen, link without the /OPTVFUNCTION option.
- If you are generating a DLL, another runtime module could make a call to your DLL that requires the virtual function. Unless you are sure this will not happen, link without the /OPTVFUNCTION option.

If you are compiling and linking in one step, you can use the /Go compiler option to invoke this optimization.

Performance Consideration: Optimized linking is slower than regular linking. You may want to link without the /OPTVFUNCTION option, until your code is tested and stable.

Summary of Linker Options