I have a dll, call it core.dll
which I want to optimize using Visual Studio's excellent Profile Guided Optimization. Most of the code is the dll actually compiles into a library called core.lib
which is then wrapped by core.dll
.
To unit-test this code I also have a tester executable called test_core.exe
. this executable links to core.lib
and activates various functions from it. The DLL core.dll
has very few exports, only enough to start its main functionality. It cannot be unit tested fully using these exports.
What I want is to do the PGO data collection by activating some of the tests in test_core.exe
and then to use this PGO data to link and optimize core.dll
.
It seems that the Visual Studio framework was designed so that the collecting executable and optimized executable are the same.
One option is to add the relevant tests to be inside core.dll
and run them using a special export but that would bloat core.dll
with test code which is not used in any other circumstance.