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