简体   繁体   中英

is there a difference between running an executable and debugging it in Visual Studio?

I'm writing a piece of code in Windows which uses both winapi messagebox and some dynamic memory for RS232 application

I saw a strange situation when the same application creates different error when I run it in debugging mode (using VS2010 and step-in debugging) and running it as an executable in command-line

in first case, the error is popped up properly with a winapi messagebox and the program returns/ends properly. Second case, it creates run-time error and also the memory leak

Is there such difference between these two run modes? and how to catch winapi run-time error?

Thanks in advance!

Yes! Running a program directly form the debugger the debug heap is in use. Assuming it isn't compiled in debug mode. And the memory layout changes when the debugger is loaded into the process address space. So some weird things may happen.

If you have such strange effects it is sometimes better to attach the debugger to the running process.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM