Partilhar via


Native Run-Time Checks Customization

When you compile with /RTC (run-time checks) or use the runtime_checks pragma, the C run-time library provides native run-time checks. In some cases, you might want to customize run-time checking:

  • To route run-time check messages to a file or destination other than the default.

  • To specify an output destination for run-time check messages under a third-party debugger.

  • To report run-time check messages from a program compiled with a release version of the C run-time library. Release versions of the library do not use _CrtDbgReportW to report run-time errors. Instead, they display an Assert dialog box for each run-time error.

To customize run-time error checking, you can:

Customize the Error Message Destination

If you use _CrtDbgReportW to report errors, you can use _CrtSetReportMode to specify the destination of error messages.

If you use a custom reporting function, use _RTC_SetErrorType to associate an error with a report type.

Query for Information About Run-Time Checks

_RTC_NumErrors returns the number of error types detected by run-time error checks. To get a brief description of each error, you can loop from 0 to the return value of _RTC_NumErrors, passing the iteration value to _RTC_GetErrDesc on each loop. For more information, see _RTC_NumErrors and _RTC_GetErrDesc.

See Also

Tasks

How to: Use Native Run-Time Checks

Reference

runtime_checks

_CrtDbgReport, _CrtDbgReportW