CLOG

A coder's BLOG from Todd S. Murchison

Recent posts

Disclaimer

The opinions expressed herein are my own and do not represent any other individual or organization.

© Copyright 2010

"Minimize Size" can be BAD

Here's a handy tidbit for anyone using Visual Studio 2005 to build C++ DLLs for Windows Mobile 5. I'm working on a DLL and I've written a small C++ test harness using LoadLibrary(), etc. I was seeing some VERY odd behavior while stepping through the code in the debugger. The symptoms seemed to suggest that the code I was seeing on the screen and that I was visually stepping through was different or out of sync with the code that was actually running.

I pulled my hair out over this for a bit, doing cleans, deleting everything in site, making SURE I was loading the version of the DLL I was building, etc. One earlier symptom was an inability to even step into the DLL calls at all! In the end it turned out to be a problem caused by a compiler flag I had changed. Because the DLL is targeted for download to Mobile devices I'm trying to make it very small. So I had right clicked on the project, selected "Properties", selected "Configuration Properties" -> "C/C++" -> "Optimizations", and changed the "Optimization" setting to "Minimize Size (/01)".

It would seem that this plays havoc with the debugger. It's a very handy option for cutting down on the size of your compiled C++, which can matter if you want to target an app for wireless download to mobile devices. For development and debugging I've set the option back to "Disabled (/0d)". This allows the debugger to correctly step through the code, hit breakpoints, etc.

-Todd

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by toddm on Thursday, September 28, 2006 7:01 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Related posts

Comments are closed