]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/msvcrt.h
synchronize GTK2 minimum version in docs
[wxWidgets.git] / include / wx / msw / msvcrt.h
CommitLineData
6e0d9d43
VZ
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// RCS-ID: $Id$
9// Copyright: (c) Vadim Zeitlin
65571936 10// Licence: wxWindows licence
6e0d9d43
VZ
11/////////////////////////////////////////////////////////////////////////////
12
13// the goal of this file is to define wxCrtSetDbgFlag() macro which may be
14// used like this:
15// wxCrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF);
16// to turn on memory leak checks for programs compiled with Microsoft Visual
4b6a582b
VZ
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.
6e0d9d43
VZ
19
20#ifndef _MSW_MSVCRT_H_
21#define _MSW_MSVCRT_H_
22
3f4a0c5b
VZ
23// use debug CRT functions for memory leak detections in VC++ 5.0+ in debug
24// builds
25#undef wxUSE_VC_CRTDBG
4b6a582b 26#if defined(_DEBUG) && defined(__VISUALC__) && (__VISUALC__ >= 1000) \
0c2d809a 27 && !defined(UNDER_CE)
3f4a0c5b 28 // it doesn't combine well with wxWin own memory debugging methods
5d06f362 29 #if !wxUSE_GLOBAL_MEMORY_OPERATORS && !wxUSE_MEMORY_TRACING && !defined(__NO_VC_CRTDBG__)
3f4a0c5b
VZ
30 #define wxUSE_VC_CRTDBG
31 #endif
6e0d9d43
VZ
32#endif
33
34#ifdef wxUSE_VC_CRTDBG
0afb5852 35 // Need to undef new if including crtdbg.h which may redefine new itself
6e0d9d43
VZ
36 #ifdef new
37 #undef new
38 #endif
39
b321fb12 40 #include <stdlib.h>
7f0da369 41 #ifndef _CRTBLD
7ef2c8e1 42 // Needed when building with pure MS SDK
7f0da369
JS
43 #define _CRTBLD
44 #endif
45
6e0d9d43
VZ
46 #include <crtdbg.h>
47
70bf6180
VZ
48 #undef WXDEBUG_NEW
49 #define WXDEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
50
b321fb12
VZ
51 // this define works around a bug with inline declarations of new, see
52 //
7ef2c8e1 53 // http://support.microsoft.com/kb/q140858/
b321fb12 54 //
0afb5852 55 // for the details
70bf6180 56 #define new WXDEBUG_NEW
b321fb12 57
6e0d9d43
VZ
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
63
3f4a0c5b
VZ
64#endif // _MSW_MSVCRT_H_
65