1 /* 2 Copyright (c) 2005-2021 Intel Corporation 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 /* 18 Replacing the standard memory allocation routines in Microsoft* C/C++ RTL 19 (malloc/free, global new/delete, etc.) with the TBB memory allocator. 20 21 Include the following header to a source of any binary which is loaded during 22 application startup 23 24 #include "oneapi/tbb/tbbmalloc_proxy.h" 25 26 or add following parameters to the linker options for the binary which is 27 loaded during application startup. It can be either exe-file or dll. 28 29 For win32 30 tbbmalloc_proxy.lib /INCLUDE:"___TBB_malloc_proxy" 31 win64 32 tbbmalloc_proxy.lib /INCLUDE:"__TBB_malloc_proxy" 33 */ 34 35 #ifndef __TBB_tbbmalloc_proxy_H 36 #define __TBB_tbbmalloc_proxy_H 37 38 #if _MSC_VER 39 40 #ifdef _DEBUG 41 #pragma comment(lib, "tbbmalloc_proxy_debug.lib") 42 #else 43 #pragma comment(lib, "tbbmalloc_proxy.lib") 44 #endif 45 46 #if defined(_WIN64) 47 #pragma comment(linker, "/include:__TBB_malloc_proxy") 48 #else 49 #pragma comment(linker, "/include:___TBB_malloc_proxy") 50 #endif 51 52 #else 53 /* Primarily to support MinGW */ 54 55 extern "C" void __TBB_malloc_proxy(); 56 struct __TBB_malloc_proxy_caller { __TBB_malloc_proxy_caller__TBB_malloc_proxy_caller57 __TBB_malloc_proxy_caller() { __TBB_malloc_proxy(); } 58 } volatile __TBB_malloc_proxy_helper_object; 59 60 #endif // _MSC_VER 61 62 /* Public Windows API */ 63 extern "C" int TBB_malloc_replacement_log(char *** function_replacement_log_ptr); 64 65 #endif //__TBB_tbbmalloc_proxy_H 66