VERSION|0.4.7.1|SUBJECT|Visual C++ .Net 2003 Standard - How To Optimize|CONTENT|[b]Problem 1:[/b]

Visual C++ .Net 2003 Standard Edition comes with a non-optimizing compiler!
How annoying!!!

[b]Fix to Problem 1:[/b]

See [url=http://www.xona.com/2004/06/29.html]this page[/url] for instructions on how to get an optimized compiler, and integrate it with the IDE.  Microsoft makes the optimizing compiler available to download [b]for free[/b].  Now, why would they let you download a free optimizing compiler, but when you pay $100 and actually buy the product, you get a non-optimizing compiler?  In the words of a friend of mine, &quot;That&#039;s some shrewd marketing.  Or something.&quot;

[b]Problem 2:[/b]

So, everything is hunky-dory now, right?  Not exactly, the optimizing options are still grayed out in the GUI, just as the [url=http://www.xona.com/2004/06/29.html]xona.com[/url] article mentions.  Well, that&#039;s not too annoying, since you can just specify /O2 or whatever in the &quot;Additional Options&quot; section.

However, it actually was still very annoying for me because I use [url=http://www.cmake.org]cmake[/url] (Cross Platform Make) for small projects and it conveniently changes a /O2 into an &#039;Optimization=&quot;2&quot;&#039; in your project file (which is the correct thing to do, if you have a normal IDE that doesn&#039;t gray out optimization options and then filter them out before launching cl.exe).  Try as I might, I could not get cmake to just put the &quot;/O2&quot; in the additional options.  I could put it in there myself manually, but the next time I reload the project, cmake conveniently rebuilds my project file.  

I&#039;m not angry with cmake.  It&#039;s doing exactly the right thing.  It&#039;s MS fault for giving me a crippled compiler!  If they are giving out a free optimizing compiler, why not actually let me use it from the IDE that I paid for!

[b]Fix to Problem 2:[/b]

Well, I wouldn&#039;t be writing this nice blog if I didn&#039;t have a solution, now would I?

There is a function in VCProjectEngine.dll that filters the command-line.  Just replace 0x74 with an 0xEB at offset 0x63D7 in the DLL and you&#039;re set!  (This only applies to VCProjectEngine.dll version 7.10.3077.0.  With version 7.10.3274.0 the offset you want is 0x6AB3.)

Best of luck.|CATEGORIES|2|DATE|1130479200