]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/msvcrt.h
Don't define __STRICT_ANSI__, we should build both with and without it.
[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
6e0d9d43 8// Copyright: (c) Vadim Zeitlin
65571936 9// Licence: wxWindows licence
6e0d9d43
VZ
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
4b6a582b
VZ
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.
6e0d9d43
VZ
18
19#ifndef _MSW_MSVCRT_H_
20#define _MSW_MSVCRT_H_
21
3f4a0c5b
VZ
22// use debug CRT functions for memory leak detections in VC++ 5.0+ in debug
23// builds
24#undef wxUSE_VC_CRTDBG
4b6a582b 25#if defined(_DEBUG) && defined(__VISUALC__) && (__VISUALC__ >= 1000) \
0c2d809a 26 && !defined(UNDER_CE)
3f4a0c5b 27 // it doesn't combine well with wxWin own memory debugging methods
5d06f362 28 #if !wxUSE_GLOBAL_MEMORY_OPERATORS && !wxUSE_MEMORY_TRACING && !defined(__NO_VC_CRTDBG__)
3f4a0c5b
VZ
29 #define wxUSE_VC_CRTDBG
30 #endif
6e0d9d43
VZ
31#endif
32
33#ifdef wxUSE_VC_CRTDBG
0afb5852 34 // Need to undef new if including crtdbg.h which may redefine new itself
6e0d9d43
VZ
35 #ifdef new
36 #undef new
37 #endif
38
b321fb12 39 #include <stdlib.h>
7f0da369 40 #ifndef _CRTBLD
7ef2c8e1 41 // Needed when building with pure MS SDK
7f0da369
JS
42 #define _CRTBLD
43 #endif
44
6e0d9d43
VZ
45 #include <crtdbg.h>
46
70bf6180
VZ
47 #undef WXDEBUG_NEW
48 #define WXDEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
49
b321fb12
VZ
50 // this define works around a bug with inline declarations of new, see
51 //
7ef2c8e1 52 // http://support.microsoft.com/kb/q140858/
b321fb12 53 //
0afb5852 54 // for the details
70bf6180 55 #define new WXDEBUG_NEW
b321fb12 56
6e0d9d43
VZ
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
3f4a0c5b
VZ
63#endif // _MSW_MSVCRT_H_
64