The first step in WPO is to compile the program (or library) and all of its units as it would be done normally, but specifying in addition the 2 following options on the command-line:
The first option tells the compiler where the WPO feedback file should be written, the second option tells the compiler to switch on WPO optimalizations.
The compiler will then, right after the program or library has been linked, collect all necessary information to perform the requested WPO options during a subsequent compilation, and will store this information in the indicated file.
To actually apply the WPO options, the program (or library) and all or some of the units that it uses, must be recompiled using the option
(Note the small caps in the w). This will tell the compiler to use the feedback file generated in the previous step. The compiler will then read the information collected about the program during the previous compiler run, and use it during the current compilation of units and/or program/library.
Units not recompiled during the second pass will obviously not be optimised, but they will still work correctly when used together with the optimised units and program/library.
Remark: Note that the options must always be specified on the command-line: there is no source directive to turn on WPO, as it makes only sense to use WPO when compiling a complete program.