]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/msvcrt.h
unicode adaption
[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 // RCS-ID: $Id$
9 // Copyright: (c) Vadim Zeitlin
10 // Licence: wxWindows licence
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
17 // C++ (5.0+). The macro will expand to nothing under other compilers.
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(__WXDEBUG__) && defined(__VISUALC__) && (__VISUALC__ >= 1000)
26 // it doesn't combine well with wxWin own memory debugging methods
27 #if !wxUSE_GLOBAL_MEMORY_OPERATORS && !wxUSE_MEMORY_TRACING && !defined(__NO_VC_CRTDBG__)
28 #define wxUSE_VC_CRTDBG
29 #endif
30 #endif
31
32 #ifdef wxUSE_VC_CRTDBG
33 // VC++ uses this macro as debug/release mode indicator
34 #ifndef _DEBUG
35 #define _DEBUG
36 #endif
37
38 // Need to undef new if including crtdbg.h which redefines new itself
39 #ifdef new
40 #undef new
41 #endif
42
43 // we need this to show file & line number of the allocation that caused
44 // the leak
45 #define _CRTDBG_MAP_ALLOC
46 #include <stdlib.h>
47 #ifndef _CRTBLD
48 // Need when builded with pure MS SDK
49 #define _CRTBLD
50 #endif
51
52 #include <crtdbg.h>
53
54 // this define works around a bug with inline declarations of new, see
55 //
56 // http://support.microsoft.com/support/kb/articles/Q140/8/58.asp
57 //
58 // for the details
59 #define new new( _NORMAL_BLOCK, __FILE__, __LINE__)
60
61 #define wxCrtSetDbgFlag(flag) \
62 _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | (flag))
63 #else // !using VC CRT
64 #define wxCrtSetDbgFlag(flag)
65 #endif // wxUSE_VC_CRTDBG
66
67 #endif // _MSW_MSVCRT_H_
68