INtime SDK Help
_CrtSetReportHook
INtime SDK v6 > About INtime > Other system libraries > Heaps and memory pools > Using the Debug Heap > Writing your own debug hook functions > _CrtSetReportHook

Installs a client-defined reporting function by hooking it into the C runtime debug reporting process (debug version only).

_CRT_REPORT_HOOK _CrtSetReportHook (
    _CRT_REPORT_HOOK reportHook 
);

Parameters

reportHook
New client-defined reporting function to hook into the C runtime debug reporting process.

Remarks

_CrtSetReportHook lets an application use its own reporting function into the C runtime debug library reporting process. As a result, whenever _CrtDbgReport is called to generate a debug report, the application's reporting function is called first. This functionality enables an application to perform operations such as filtering debug reports so it can focus on specific allocation types or send a report to destinations not available by using _CrtDbgReport. When _DEBUG is not defined, preprocessing removes calls to _CrtSetReportHook.

_CrtSetReportHook installs the new client-defined reporting function specified in reportHook and returns the previous client-defined hook. The following example demonstrates how to prototype a client-defined report hook:

int YourReportHook( int reportType, char *message, int *returnValue );

Parameters

reportType
The debug report type. Valid values include:
_CRT_WARN
_CRT_ERROR
_CRT_ASSERT
message
The fully assembled debug user message to include in the report.
returnValue
The value specified by the client-defined reporting function that _CrtDbgReport returns.

For a complete description of the available report types, see _CrtSetReportMode.

If the client-defined reporting function completely handles the debug message such that no further reporting is required, then the function returns TRUE. When the function returns FALSE, _CrtDbgReport is called to generate the debug report using the current settings for the report type, mode, and file. In addition, by specifying the _CrtDbgReport return value in returnValue, the application can also control whether a debug break occurs. For a complete description of how the debug report is configured and generated, see _CrtSetReportMode, _CrtSetReportFile, and _CrtDbgReport.

For more information about using other hook-capable run-time functions and writing your own client-defined hook functions, see Writing Your Own Debug Hook Functions.

Return Values

The previous client-defined reporting function.

Requirements

Versions Defined in Include Link to
INtime 3.13 intime/rt/include/crtdbg.h crtdbg.h clib.lib
   
See Also