]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/msvcrt.h
wxRTC: fixed guidelines overwriting adjacent cell borders; corrected capitalisation...
[wxWidgets.git] / include / wx / msw / msvcrt.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/msvcrt.h
3 // Purpose: macros to use some non-standard features of MS Visual C++
4 // C run-time library
5 // Author: Vadim Zeitlin
6 // Modified by:
7 // Created: 31.01.1999
8 // Copyright: (c) Vadim Zeitlin
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // the goal of this file is to define wxCrtSetDbgFlag() macro which may be
13 // used like this:
14 // wxCrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF);
15 // to turn on memory leak checks for programs compiled with Microsoft Visual
16 // C++ (5.0+). The macro will not be defined under other compilers or if it
17 // can't be used with MSVC for whatever reason.
18
19 #ifndef _MSW_MSVCRT_H_
20 #define _MSW_MSVCRT_H_
21
22 // use debug CRT functions for memory leak detections in VC++ 5.0+ in debug
23 // builds
24 #undef wxUSE_VC_CRTDBG
25 #if defined(_DEBUG) && defined(__VISUALC__) && (__VISUALC__ >= 1000) \
26 && !defined(UNDER_CE)
27 // it doesn't combine well with wxWin own memory debugging methods
28 #if !wxUSE_GLOBAL_MEMORY_OPERATORS && !wxUSE_MEMORY_TRACING && !defined(__NO_VC_CRTDBG__)
29 #define wxUSE_VC_CRTDBG
30 #endif
31 #endif
32
33 #ifdef wxUSE_VC_CRTDBG
34 // Need to undef new if including crtdbg.h which may redefine new itself
35 #ifdef new
36 #undef new
37 #endif
38
39 #include <stdlib.h>
40 #ifndef _CRTBLD
41 // Needed when building with pure MS SDK
42 #define _CRTBLD
43 #endif
44
45 #include <crtdbg.h>
46
47 #undef WXDEBUG_NEW
48 #define WXDEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
49
50 // this define works around a bug with inline declarations of new, see
51 //
52 // http://support.microsoft.com/kb/q140858/
53 //
54 // for the details
55 #define new WXDEBUG_NEW
56
57 #define wxCrtSetDbgFlag(flag) \
58 _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | (flag))
59 #else // !using VC CRT
60 #define wxCrtSetDbgFlag(flag)
61 #endif // wxUSE_VC_CRTDBG
62
63 #endif // _MSW_MSVCRT_H_
64