]> git.lyx.org Git - lyx.git/blob - development/Win32/vld/src/vld.h
visual leak detector: update add patch for msvc10
[lyx.git] / development / Win32 / vld / src / vld.h
1 ////////////////////////////////////////////////////////////////////////////////\r
2 //\r
3 //  Visual Leak Detector - Import Library Header\r
4 //  Copyright (c) 2006 Dan Moulding\r
5 //\r
6 //  This library is free software; you can redistribute it and/or\r
7 //  modify it under the terms of the GNU Lesser General Public\r
8 //  License as published by the Free Software Foundation; either\r
9 //  version 2.1 of the License, or (at your option) any later version.\r
10 //\r
11 //  This library is distributed in the hope that it will be useful,\r
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
14 //  Lesser General Public License for more details.\r
15 //\r
16 //  You should have received a copy of the GNU Lesser General Public\r
17 //  License along with this library; if not, write to the Free Software\r
18 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
19 //\r
20 //  See COPYING.txt for the full terms of the GNU Lesser General Public License.\r
21 //\r
22 ////////////////////////////////////////////////////////////////////////////////\r
23 \r
24 #pragma once\r
25 \r
26 #ifdef _DEBUG\r
27 \r
28 #pragma comment(lib, "vld.lib")\r
29 \r
30 // Force a symbolic reference to the global VisualLeakDetector class object from\r
31 // the DLL. This enusres that the DLL is loaded and linked with the program,\r
32 // even if no code otherwise imports any of the DLL's exports.\r
33 #pragma comment(linker, "/include:__imp_?vld@@3VVisualLeakDetector@@A")\r
34 \r
35 ////////////////////////////////////////////////////////////////////////////////\r
36 //\r
37 //  Visual Leak Detector APIs\r
38 //\r
39 \r
40 #ifdef __cplusplus\r
41 extern "C" {\r
42 #endif // __cplusplus\r
43 \r
44 // VLDDisable - Disables Visual Leak Detector's memory leak detection at\r
45 //   runtime. If memory leak detection is already disabled, then calling this\r
46 //   function has no effect.\r
47 //\r
48 //  Note: In multithreaded programs, this function operates on a per-thread\r
49 //    basis. In other words, if you call this function from one thread, then\r
50 //    memory leak detection is only disabled for that thread. If memory leak\r
51 //    detection is enabled for other threads, then it will remain enabled for\r
52 //    those other threads. It was designed to work this way to insulate you,\r
53 //    the programmer, from having to ensure thread synchronization when calling\r
54 //    VLDEnable() and VLDDisable(). Without this, calling these two functions\r
55 //    unsychronized could result in unpredictable and unintended behavior.\r
56 //    But this also means that if you want to disable memory leak detection\r
57 //    process-wide, then you need to call this function from every thread in\r
58 //    the process.\r
59 //\r
60 //  Return Value:\r
61 //\r
62 //    None.\r
63 //\r
64 __declspec(dllimport) void VLDDisable ();\r
65 \r
66 // VLDEnable - Enables Visual Leak Detector's memory leak detection at runtime.\r
67 //   If memory leak detection is already enabled, which it is by default, then\r
68 //   calling this function has no effect.\r
69 //\r
70 //  Note: In multithreaded programs, this function operates on a per-thread\r
71 //    basis. In other words, if you call this function from one thread, then\r
72 //    memory leak detection is only enabled for that thread. If memory leak\r
73 //    detection is disabled for other threads, then it will remain disabled for\r
74 //    those other threads. It was designed to work this way to insulate you,\r
75 //    the programmer, from having to ensure thread synchronization when calling\r
76 //    VLDEnable() and VLDDisable(). Without this, calling these two functions\r
77 //    unsychronized could result in unpredictable and unintended behavior.\r
78 //    But this also means that if you want to enable memory leak detection\r
79 //    process-wide, then you need to call this function from every thread in\r
80 //    the process.\r
81 //\r
82 //  Return Value:\r
83 //\r
84 //    None.\r
85 //\r
86 __declspec(dllimport) void VLDEnable ();\r
87 \r
88 #ifdef __cplusplus\r
89 }\r
90 #endif // __cplusplus\r
91 \r
92 #else // !_DEBUG\r
93 \r
94 #define VLDEnable()\r
95 #define VLDDisable()\r
96 \r
97 #endif // _DEBUG\r