BRE12
runtime_loader.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 #ifndef __TBB_runtime_loader_H
22 #define __TBB_runtime_loader_H
23 
24 #if ! TBB_PREVIEW_RUNTIME_LOADER
25  #error Set TBB_PREVIEW_RUNTIME_LOADER to include runtime_loader.h
26 #endif
27 
28 #include "tbb_stddef.h"
29 #include <climits>
30 
31 #if _MSC_VER
32  #if ! __TBB_NO_IMPLICIT_LINKAGE
33  #ifdef _DEBUG
34  #pragma comment( linker, "/nodefaultlib:tbb_debug.lib" )
35  #pragma comment( linker, "/defaultlib:tbbproxy_debug.lib" )
36  #else
37  #pragma comment( linker, "/nodefaultlib:tbb.lib" )
38  #pragma comment( linker, "/defaultlib:tbbproxy.lib" )
39  #endif
40  #endif
41 #endif
42 
43 namespace tbb {
44 
45 namespace interface6 {
46 
48 
85 class runtime_loader : tbb::internal::no_copy {
86 
87  public:
88 
90  enum error_mode {
94  }; // error_mode
95 
97  enum error_code {
104  }; // error_code
105 
108 
110 
116  char const * path[],
117  int min_ver = TBB_INTERFACE_VERSION,
118  int max_ver = INT_MAX,
119  error_mode mode = em_abort
120  );
121 
123  ~runtime_loader();
124 
126 
150  error_code
151  load(
152  char const * path[],
153  int min_ver = TBB_INTERFACE_VERSION,
154  int max_ver = INT_MAX
155 
156  );
157 
158 
160 
163  error_code status();
164 
165  private:
166 
167  error_mode const my_mode;
168  error_code my_status;
169  bool my_loaded;
170 
171 }; // class runtime_loader
172 
173 } // namespace interface6
174 
176 
177 } // namespace tbb
178 
179 #endif /* __TBB_runtime_loader_H */
180 
error_mode
Error mode constants.
Definition: runtime_loader.h:90
Invalid argument passed.
Definition: runtime_loader.h:100
~runtime_loader()
Destroy object.
Save status of operation and continue.
Definition: runtime_loader.h:91
Throw an exception of tbb::runtime_loader::error_code type.
Definition: runtime_loader.h:92
No suitable TBB library found.
Definition: runtime_loader.h:103
Print message to stderr and call abort().
Definition: runtime_loader.h:93
Invalid library found (e. g. TBB_runtime_version symbol not found).
Definition: runtime_loader.h:101
error_code load(char const *path[], int min_ver=TBB_INTERFACE_VERSION, int max_ver=INT_MAX)
Load TBB.
runtime_loader(error_mode mode=em_abort)
Initialize object but do not load TBB.
error_code status()
Report status.
Invalid function call (e. g. load() called when TBB is already loaded).
Definition: runtime_loader.h:99
Load TBB at runtime.
Definition: runtime_loader.h:85
error_code
Error codes.
Definition: runtime_loader.h:97
TBB found but version is not suitable.
Definition: runtime_loader.h:102
The namespace tbb contains all components of the library.
Definition: parallel_for.h:44
No errors.
Definition: runtime_loader.h:98