00001 00002 // $Id: vld.h,v 1.27 2006/11/12 18:09:20 dmouldin Exp $ 00003 // 00004 // Visual Leak Detector (Version 1.9d) - Import Library Header 00005 // Copyright (c) 2006 Dan Moulding 00006 // 00007 // This library is free software; you can redistribute it and/or 00008 // modify it under the terms of the GNU Lesser General Public 00009 // License as published by the Free Software Foundation; either 00010 // version 2.1 of the License, or (at your option) any later version. 00011 // 00012 // This library is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 // Lesser General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU Lesser General Public 00018 // License along with this library; if not, write to the Free Software 00019 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00020 // 00021 // See COPYING.txt for the full terms of the GNU Lesser General Public License. 00022 // 00024 00025 #pragma once 00026 00027 #ifdef _DEBUG 00028 00029 #pragma comment(lib, "vld.lib") 00030 00031 // Force a symbolic reference to the global VisualLeakDetector class object from 00032 // the DLL. This enusres that the DLL is loaded and linked with the program, 00033 // even if no code otherwise imports any of the DLL's exports. 00034 #pragma comment(linker, "/include:__imp_?vld@@3VVisualLeakDetector@@A") 00035 00037 // 00038 // Visual Leak Detector APIs 00039 // 00040 00041 #ifdef __cplusplus 00042 extern "C" { 00043 #endif // __cplusplus 00044 00045 // VLDDisable - Disables Visual Leak Detector's memory leak detection at 00046 // runtime. If memory leak detection is already disabled, then calling this 00047 // function has no effect. 00048 // 00049 // Note: In multithreaded programs, this function operates on a per-thread 00050 // basis. In other words, if you call this function from one thread, then 00051 // memory leak detection is only disabled for that thread. If memory leak 00052 // detection is enabled for other threads, then it will remain enabled for 00053 // those other threads. It was designed to work this way to insulate you, 00054 // the programmer, from having to ensure thread synchronization when calling 00055 // VLDEnable() and VLDDisable(). Without this, calling these two functions 00056 // unsychronized could result in unpredictable and unintended behavior. 00057 // But this also means that if you want to disable memory leak detection 00058 // process-wide, then you need to call this function from every thread in 00059 // the process. 00060 // 00061 // Return Value: 00062 // 00063 // None. 00064 // 00065 __declspec(dllimport) void VLDDisable (); 00066 00067 // VLDEnable - Enables Visual Leak Detector's memory leak detection at runtime. 00068 // If memory leak detection is already enabled, which it is by default, then 00069 // calling this function has no effect. 00070 // 00071 // Note: In multithreaded programs, this function operates on a per-thread 00072 // basis. In other words, if you call this function from one thread, then 00073 // memory leak detection is only enabled for that thread. If memory leak 00074 // detection is disabled for other threads, then it will remain disabled for 00075 // those other threads. It was designed to work this way to insulate you, 00076 // the programmer, from having to ensure thread synchronization when calling 00077 // VLDEnable() and VLDDisable(). Without this, calling these two functions 00078 // unsychronized could result in unpredictable and unintended behavior. 00079 // But this also means that if you want to enable memory leak detection 00080 // process-wide, then you need to call this function from every thread in 00081 // the process. 00082 // 00083 // Return Value: 00084 // 00085 // None. 00086 // 00087 __declspec(dllimport) void VLDEnable (); 00088 00089 #ifdef __cplusplus 00090 } 00091 #endif // __cplusplus 00092 00093 #else // !_DEBUG 00094 00095 #define VLDEnable() 00096 #define VLDDisable() 00097 00098 #endif // _DEBUG