]>
git.saurik.com Git - wxWidgets.git/blob - 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++
5 // Author: Vadim Zeitlin
9 // Copyright: (c) Vadim Zeitlin
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
13 // the goal of this file is to define wxCrtSetDbgFlag() macro which may be
15 // wxCrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF);
16 // to turn on memory leak checks for programs compiled with Microsoft Visual
17 // C++ (5.0+). The macro will not be defined under other compilers or if it
18 // can't be used with MSVC for whatever reason.
20 #ifndef _MSW_MSVCRT_H_
21 #define _MSW_MSVCRT_H_
23 // use debug CRT functions for memory leak detections in VC++ 5.0+ in debug
25 #undef wxUSE_VC_CRTDBG
26 #if defined(_DEBUG) && defined(__VISUALC__) && (__VISUALC__ >= 1000) \
28 // it doesn't combine well with wxWin own memory debugging methods
29 #if !wxUSE_GLOBAL_MEMORY_OPERATORS && !wxUSE_MEMORY_TRACING && !defined(__NO_VC_CRTDBG__)
30 #define wxUSE_VC_CRTDBG
34 #ifdef wxUSE_VC_CRTDBG
35 // Need to undef new if including crtdbg.h which may redefine new itself
42 // Needed when building with pure MS SDK
49 #define WXDEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
51 // this define works around a bug with inline declarations of new, see
53 // http://support.microsoft.com/kb/q140858/
56 #define new WXDEBUG_NEW
58 #define wxCrtSetDbgFlag(flag) \
59 _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | (flag))
60 #else // !using VC CRT
61 #define wxCrtSetDbgFlag(flag)
62 #endif // wxUSE_VC_CRTDBG
64 #endif // _MSW_MSVCRT_H_