Export (0) Print
Expand All

Source Code for the C Run-Time Functions

Visual Studio 6.0

Visual C++ introduces source code availability for most of the C run-time library functions. You can now use the debugger to step into the source code for the run-time functions by linking your application with a debug version of the run-time library. During the debugging process, source code availability allows you to confirm that the run-time functions are working as expected, check for bad parameters and memory states, and examine your code for other errors.

Because the C run-time library has been designed to achieve the highest possible performance, the release versions of the functions rarely verify parameters, confirm internal states, or perform other checking that might slow program execution. As a result, an incorrect call to a run-time function can result in serious problems accompanied by too little information to resolve the situation. For example, passing a bad pointer to the strcpy function usually results in a simple “General Protection Fault” error message. The ability to step into the run-time source code allows you to control the type of verifications and how many to perform, as well as the opportunity to trace through the execution of your application to resolve specific problems.

The Setup program gives you the option of installing the C run-time library source code on your hard disk. Even if you choose to leave the source files on the compact disc, you can step into run-time functions while you are debugging, as long as the compact disc is loaded in the drive.

The main definitions and macros that control the debugging process are contained in the CRTDBG.H header file. Experienced programmers should examine this file to understand how to take full advantage of the flexibility that the new debug libraries offer.

Source code for the debug run-time functions is contained in source files whose names begin with dbg. Source code for the other C run-time functions is contained in files whose names reflect the function names. However, Microsoft considers some run-time technology to be proprietary and does not provide source code for the exception handling, floating point, and a few other routines. For a complete list of these routines, see Debug Routines.

© 2014 Microsoft