]> git.lyx.org Git - lyx.git/blob - development/Win32/vld/src/vld.h
Convert files to unix line ends in the repo
[lyx.git] / development / Win32 / vld / src / vld.h
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 //  Visual Leak Detector - Import Library Header
4 //  Copyright (c) 2006 Dan Moulding
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 //
22 ////////////////////////////////////////////////////////////////////////////////
23
24 #pragma once
25
26 #ifdef _DEBUG
27
28 #pragma comment(lib, "vld.lib")
29
30 // Force a symbolic reference to the global VisualLeakDetector class object from
31 // the DLL. This enusres that the DLL is loaded and linked with the program,
32 // even if no code otherwise imports any of the DLL's exports.
33 #pragma comment(linker, "/include:__imp_?vld@@3VVisualLeakDetector@@A")
34
35 ////////////////////////////////////////////////////////////////////////////////
36 //
37 //  Visual Leak Detector APIs
38 //
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif // __cplusplus
43
44 // VLDDisable - Disables Visual Leak Detector's memory leak detection at
45 //   runtime. If memory leak detection is already disabled, then calling this
46 //   function has no effect.
47 //
48 //  Note: In multithreaded programs, this function operates on a per-thread
49 //    basis. In other words, if you call this function from one thread, then
50 //    memory leak detection is only disabled for that thread. If memory leak
51 //    detection is enabled for other threads, then it will remain enabled for
52 //    those other threads. It was designed to work this way to insulate you,
53 //    the programmer, from having to ensure thread synchronization when calling
54 //    VLDEnable() and VLDDisable(). Without this, calling these two functions
55 //    unsychronized could result in unpredictable and unintended behavior.
56 //    But this also means that if you want to disable memory leak detection
57 //    process-wide, then you need to call this function from every thread in
58 //    the process.
59 //
60 //  Return Value:
61 //
62 //    None.
63 //
64 __declspec(dllimport) void VLDDisable ();
65
66 // VLDEnable - Enables Visual Leak Detector's memory leak detection at runtime.
67 //   If memory leak detection is already enabled, which it is by default, then
68 //   calling this function has no effect.
69 //
70 //  Note: In multithreaded programs, this function operates on a per-thread
71 //    basis. In other words, if you call this function from one thread, then
72 //    memory leak detection is only enabled for that thread. If memory leak
73 //    detection is disabled for other threads, then it will remain disabled for
74 //    those other threads. It was designed to work this way to insulate you,
75 //    the programmer, from having to ensure thread synchronization when calling
76 //    VLDEnable() and VLDDisable(). Without this, calling these two functions
77 //    unsychronized could result in unpredictable and unintended behavior.
78 //    But this also means that if you want to enable memory leak detection
79 //    process-wide, then you need to call this function from every thread in
80 //    the process.
81 //
82 //  Return Value:
83 //
84 //    None.
85 //
86 __declspec(dllimport) void VLDEnable ();
87
88 #ifdef __cplusplus
89 }
90 #endif // __cplusplus
91
92 #else // !_DEBUG
93
94 #define VLDEnable()
95 #define VLDDisable()
96
97 #endif // _DEBUG