RioEngine  0.1
My first attempt to create a 3D WYSIWYG Game Engine
vld.h
Go to the documentation of this file.
1 //
3 // Visual Leak Detector - Import Library Header
4 // Copyright (c) 2005-2013 VLD Team
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 //
20 // See COPYING.txt for the full terms of the GNU Lesser General Public License.
21 //
23 
24 #pragma once
25 
26 #include "vld_def.h"
27 
28 #if defined _DEBUG || defined VLD_FORCE_ENABLE
29 
30 #include <windows.h>
31 
32 #pragma comment(lib, "vld.lib")
33 
34 // Force a symbolic reference to the global VisualLeakDetector class object from
35 // the DLL. This ensures that the DLL is loaded and linked with the program,
36 // even if no code otherwise imports any of the DLL's exports.
37 #pragma comment(linker, "/include:__imp_?g_vld@@3VVisualLeakDetector@@A")
38 
40 //
41 // Visual Leak Detector APIs
42 //
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif // __cplusplus
47 
48 // VLDDisable - Disables Visual Leak Detector's memory leak detection at
49 // runtime. If memory leak detection is already disabled, then calling this
50 // function has no effect.
51 //
52 // Note: In multithreaded programs, this function operates on a per-thread
53 // basis. In other words, if you call this function from one thread, then
54 // memory leak detection is only disabled for that thread. If memory leak
55 // detection is enabled for other threads, then it will remain enabled for
56 // those other threads. It was designed to work this way to insulate you,
57 // the programmer, from having to ensure thread synchronization when calling
58 // VLDEnable() and VLDDisable(). Without this, calling these two functions
59 // unsynchronized could result in unpredictable and unintended behavior.
60 // But this also means that if you want to disable memory leak detection
61 // process-wide, then you need to call this function from every thread in
62 // the process.
63 //
64 // Return Value:
65 //
66 // None.
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 // unsynchronized 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 __declspec(dllimport) void VLDEnable ();
91 
92 // VLDRestore - Restore Visual Leak Detector's previous state.
93 //
94 // Return Value:
95 //
96 // None.
97 //
98 __declspec(dllimport) void VLDRestore ();
99 
100 // VLDGlobalDisable - Disables Visual Leak Detector's memory leak detection at
101 // runtime in all threads. If memory leak detection is already disabled,
102 // then calling this function has no effect.
103 //
104 // Return Value:
105 //
106 // None.
107 //
108 __declspec(dllimport) void VLDGlobalDisable ();
109 
110 // VLDGlobalEnable - Enables Visual Leak Detector's memory leak detection
111 // at runtime in all threads. If memory leak detection is already enabled,
112 // which it is by default, then calling this function has no effect.
113 //
114 // Return Value:
115 //
116 // None.
117 //
118 __declspec(dllimport) void VLDGlobalEnable ();
119 
120 // VLDReportLeaks - Report leaks up to the execution point.
121 //
122 // Return Value:
123 //
124 // None.
125 //
126 __declspec(dllimport) UINT VLDReportLeaks ();
127 
128 // VLDGetLeaksCount - Return memory leaks count to the execution point.
129 //
130 // Return Value:
131 //
132 // None.
133 //
134 __declspec(dllimport) UINT VLDGetLeaksCount ();
135 
136 // VLDMarkAllLeaksAsReported - Mark all leaks as reported.
137 //
138 // Return Value:
139 //
140 // None.
141 //
142 __declspec(dllimport) void VLDMarkAllLeaksAsReported ();
143 
144 
145 // VLDRefreshModules - Look for recently loaded DLLs and patch them if necessary.
146 //
147 // Return Value:
148 //
149 // None.
150 //
151 __declspec(dllimport) void VLDRefreshModules();
152 
153 
154 // VLDEnableModule - Enable Memory leak checking on the specified module.
155 //
156 // module: module handle.
157 //
158 // Return Value:
159 //
160 // None.
161 //
162 
163 __declspec(dllimport) void VLDEnableModule(HMODULE module);
164 
165 
166 // VLDDisableModule - Disable Memory leak checking on the specified module.
167 //
168 // module: module handle.
169 //
170 // Return Value:
171 //
172 // None.
173 //
174 __declspec(dllimport) void VLDDisableModule(HMODULE module);
175 
176 // VLDGetOptions - Return all current options.
177 //
178 // Return Value:
179 //
180 // Mask of current options.
181 //
182 __declspec(dllimport) UINT VLDGetOptions();
183 
184 // VLDGetReportFilename - Return current report filename.
185 //
186 // filename: current report filename (max characters - MAX_PATH).
187 //
188 // Return Value:
189 //
190 // None.
191 //
192 __declspec(dllimport) void VLDGetReportFilename(WCHAR *filename);
193 
194 // VLDSetOptions - Update the report options via function call rather than INI file.
195 //
196 // option_mask: Only the following flags are checked
197 // VLD_OPT_AGGREGATE_DUPLICATES
198 // VLD_OPT_MODULE_LIST_INCLUDE
199 // VLD_OPT_SAFE_STACK_WALK
200 // VLD_OPT_SLOW_DEBUGGER_DUMP
201 // VLD_OPT_TRACE_INTERNAL_FRAMES
202 // VLD_OPT_START_DISABLED
203 // VLD_OPT_SKIP_HEAPFREE_LEAKS
204 // VLD_OPT_VALIDATE_HEAPFREE
205 //
206 // maxDataDump: maximum number of user-data bytes to dump for each leaked block.
207 //
208 // maxTraceFrames: maximum number of frames per stack trace for each leaked block.
209 //
210 // Return Value:
211 //
212 // None.
213 //
214 __declspec(dllimport) void VLDSetOptions(UINT option_mask, SIZE_T maxDataDump, UINT maxTraceFrames);
215 
216 // VLDSetModulesList - Set list of modules included/excluded in leak detection
217 // depending on parameter "includeModules".
218 //
219 // modules: list of modules to be forcefully included/excluded in leak detection.
220 //
221 // includeModules: include or exclude that modules.
222 //
223 // Return Value:
224 //
225 // None.
226 //
227 __declspec(dllimport) void VLDSetModulesList(CONST WCHAR *modules, BOOL includeModules);
228 
229 // VLDGetModulesList - Return current list of included/excluded modules
230 // depending on flag VLD_OPT_TRACE_INTERNAL_FRAMES.
231 //
232 // modules: destination string for list of included/excluded modules (maximum length 512 characters).
233 //
234 // size: maximum string size.
235 //
236 // Return Value:
237 //
238 // BOOL: TRUE if include modules, otherwise FALSE.
239 //
240 __declspec(dllimport) BOOL VLDGetModulesList(WCHAR *modules, UINT size);
241 
242 // VLDSetReportOptions - Update the report options via function call rather than INI file.
243 //
244 // Only the following flags are checked
245 // VLD_OPT_REPORT_TO_DEBUGGER
246 // VLD_OPT_REPORT_TO_FILE
247 // VLD_OPT_REPORT_TO_STDOUT
248 // VLD_OPT_UNICODE_REPORT
249 //
250 // filename is optional and can be NULL.
251 //
252 // Return Value:
253 //
254 // None.
255 //
256 __declspec(dllimport) void VLDSetReportOptions(UINT option_mask, CONST WCHAR *filename);
257 
258 // VLDSetReportHook - Installs or uninstalls a client-defined reporting function by hooking it
259 // into the C run-time debug reporting process (debug version only).
260 //
261 // mode: The action to take: VLD_RPTHOOK_INSTALL or VLD_RPTHOOK_REMOVE.
262 //
263 // pfnNewHook: Report hook to install or remove.
264 //
265 // Return Value:
266 //
267 // int: 0 if success.
268 //
269 __declspec(dllimport) int VLDSetReportHook(int mode, VLD_REPORT_HOOK pfnNewHook);
270 
271 // VLDResolveCallstacks - Performs symbol resolution for all saved extent CallStack's that have
272 // been tracked by Visual Leak Detector. This function is necessary for applications that
273 // dynamically load and unload modules, and through which memory leaks might be included.
274 // If this is NOT called, stack traces may have stack frames with no symbol information. This
275 // happens because the symbol API's cannot look up symbols for a binary / module that has been unloaded
276 // from the process.
277 //
278 // Return Value:
279 //
280 // None.
281 //
282 __declspec(dllexport) void VLDResolveCallstacks();
283 
284 #ifdef __cplusplus
285 }
286 #endif // __cplusplus
287 
288 #else // !_DEBUG
289 
290 #define VLDEnable()
291 #define VLDDisable()
292 #define VLDRestore()
293 #define VLDReportLeaks() 0
294 #define VLDGetLeaksCount() 0
295 #define VLDMarkAllLeaksAsReported()
296 #define VLDRefreshModules()
297 #define VLDEnableModule(a)
298 #define VLDDisableModule(b)
299 #define VLDGetOptions() 0
300 #define VLDGetReportFilename(a)
301 #define VLDSetOptions(a, b, c)
302 #define VLDSetReportHook(a, b)
303 #define VLDSetModulesList(a)
304 #define VLDGetModulesList(a, b) FALSE
305 #define VLDSetReportOptions(a, b)
306 
307 #endif // _DEBUG
#define VLDDisable()
Definition: vld.h:291
#define VLDGetOptions()
Definition: vld.h:299
int(__cdecl * VLD_REPORT_HOOK)(int reportType, wchar_t *message, int *returnValue)
Definition: vld_def.h:45
#define VLDGetModulesList(a, b)
Definition: vld.h:304
#define VLDGetReportFilename(a)
Definition: vld.h:300
#define VLDSetReportOptions(a, b)
Definition: vld.h:305
#define VLDReportLeaks()
Definition: vld.h:293
#define VLDSetReportHook(a, b)
Definition: vld.h:302
#define VLDRefreshModules()
Definition: vld.h:296
#define VLDSetOptions(a, b, c)
Definition: vld.h:301
#define VLDGetLeaksCount()
Definition: vld.h:294
#define VLDRestore()
Definition: vld.h:292
#define VLDEnable()
Definition: vld.h:290
#define VLDDisableModule(b)
Definition: vld.h:298
#define VLDEnableModule(a)
Definition: vld.h:297
#define VLDMarkAllLeaksAsReported()
Definition: vld.h:295
#define VLDSetModulesList(a)
Definition: vld.h:303