BRE12
tbbmalloc_proxy.h
1 /*
2  Copyright 2005-2016 Intel Corporation. All Rights Reserved.
3 
4  This file is part of Threading Building Blocks. Threading Building Blocks is free software;
5  you can redistribute it and/or modify it under the terms of the GNU General Public License
6  version 2 as published by the Free Software Foundation. Threading Building Blocks is
7  distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
8  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9  See the GNU General Public License for more details. You should have received a copy of
10  the GNU General Public License along with Threading Building Blocks; if not, write to the
11  Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
12 
13  As a special exception, you may use this file as part of a free software library without
14  restriction. Specifically, if other files instantiate templates or use macros or inline
15  functions from this file, or you compile this file and link it with other files to produce
16  an executable, this file does not by itself cause the resulting executable to be covered
17  by the GNU General Public License. This exception does not however invalidate any other
18  reasons why the executable file might be covered by the GNU General Public License.
19 */
20 
21 /*
22 Replacing the standard memory allocation routines in Microsoft* C/C++ RTL
23 (malloc/free, global new/delete, etc.) with the TBB memory allocator.
24 
25 Include the following header to a source of any binary which is loaded during
26 application startup
27 
28 #include "tbb/tbbmalloc_proxy.h"
29 
30 or add following parameters to the linker options for the binary which is
31 loaded during application startup. It can be either exe-file or dll.
32 
33 For win32
34 tbbmalloc_proxy.lib /INCLUDE:"___TBB_malloc_proxy"
35 win64
36 tbbmalloc_proxy.lib /INCLUDE:"__TBB_malloc_proxy"
37 */
38 
39 #ifndef __TBB_tbbmalloc_proxy_H
40 #define __TBB_tbbmalloc_proxy_H
41 
42 #if _MSC_VER
43 
44 #ifdef _DEBUG
45  #pragma comment(lib, "tbbmalloc_proxy_debug.lib")
46 #else
47  #pragma comment(lib, "tbbmalloc_proxy.lib")
48 #endif
49 
50 #if defined(_WIN64)
51  #pragma comment(linker, "/include:__TBB_malloc_proxy")
52 #else
53  #pragma comment(linker, "/include:___TBB_malloc_proxy")
54 #endif
55 
56 #else
57 /* Primarily to support MinGW */
58 
59 extern "C" void __TBB_malloc_proxy();
61  __TBB_malloc_proxy_caller() { __TBB_malloc_proxy(); }
62 } volatile __TBB_malloc_proxy_helper_object;
63 
64 #endif // _MSC_VER
65 
66 #endif //__TBB_tbbmalloc_proxy_H
Definition: tbbmalloc_proxy.h:60