Intel(R) Threading Building Blocks Doxygen Documentation version 4.2.3
dynamic_link.cpp
Go to the documentation of this file.
1/*
2 Copyright (c) 2005-2020 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#include "dynamic_link.h"
18#include "tbb/tbb_config.h"
19
20/*
21 This file is used by both TBB and OpenMP RTL. Do not use __TBB_ASSERT() macro
22 and runtime_warning() function because they are not available in OpenMP. Use
23 LIBRARY_ASSERT and DYNAMIC_LINK_WARNING instead.
24*/
25
26#include <cstdarg> // va_list etc.
27#if _WIN32
28 #include <malloc.h>
29
30 // Unify system calls
31 #define dlopen( name, flags ) LoadLibrary( name )
32 #define dlsym( handle, name ) GetProcAddress( handle, name )
33 #define dlclose( handle ) ( ! FreeLibrary( handle ) )
34 #define dlerror() GetLastError()
35#ifndef PATH_MAX
36 #define PATH_MAX MAX_PATH
37#endif
38#else /* _WIN32 */
39 #include <dlfcn.h>
40 #include <string.h>
41 #include <unistd.h>
42 #include <limits.h>
43 #include <stdlib.h>
44#endif /* _WIN32 */
45
46#if __TBB_WEAK_SYMBOLS_PRESENT && !__TBB_DYNAMIC_LOAD_ENABLED
47 //TODO: use function attribute for weak symbols instead of the pragma.
48 #pragma weak dlopen
49 #pragma weak dlsym
50 #pragma weak dlclose
51#endif /* __TBB_WEAK_SYMBOLS_PRESENT && !__TBB_DYNAMIC_LOAD_ENABLED */
52
53#include "tbb_misc.h"
54
55#define __USE_TBB_ATOMICS ( !(__linux__&&__ia64__) || __TBB_BUILD )
56#define __USE_STATIC_DL_INIT ( !__ANDROID__ )
57
58#if !__USE_TBB_ATOMICS
59#include <pthread.h>
60#endif
61
62/*
63dynamic_link is a common interface for searching for required symbols in an
64executable and dynamic libraries.
65
66dynamic_link provides certain guarantees:
67 1. Either all or none of the requested symbols are resolved. Moreover, if
68 symbols are not resolved, the dynamic_link_descriptor table is not modified;
69 2. All returned symbols have secured lifetime: this means that none of them
70 can be invalidated until dynamic_unlink is called;
71 3. Any loaded library is loaded only via the full path. The full path is that
72 from which the runtime itself was loaded. (This is done to avoid security
73 issues caused by loading libraries from insecure paths).
74
75dynamic_link searches for the requested symbols in three stages, stopping as
76soon as all of the symbols have been resolved.
77
78 1. Search the global scope:
79 a. On Windows: dynamic_link tries to obtain the handle of the requested
80 library and if it succeeds it resolves the symbols via that handle.
81 b. On Linux: dynamic_link tries to search for the symbols in the global
82 scope via the main program handle. If the symbols are present in the global
83 scope their lifetime is not guaranteed (since dynamic_link does not know
84 anything about the library from which they are exported). Therefore it
85 tries to "pin" the symbols by obtaining the library name and reopening it.
86 dlopen may fail to reopen the library in two cases:
87 i. The symbols are exported from the executable. Currently dynamic _link
88 cannot handle this situation, so it will not find these symbols in this
89 step.
90 ii. The necessary library has been unloaded and cannot be reloaded. It
91 seems there is nothing that can be done in this case. No symbols are
92 returned.
93
94 2. Dynamic load: an attempt is made to load the requested library via the
95 full path.
96 The full path used is that from which the runtime itself was loaded. If the
97 library can be loaded, then an attempt is made to resolve the requested
98 symbols in the newly loaded library.
99 If the symbols are not found the library is unloaded.
100
101 3. Weak symbols: if weak symbols are available they are returned.
102*/
103
105
106#if __TBB_WEAK_SYMBOLS_PRESENT || __TBB_DYNAMIC_LOAD_ENABLED
107
108#if !defined(DYNAMIC_LINK_WARNING) && !__TBB_WIN8UI_SUPPORT && __TBB_DYNAMIC_LOAD_ENABLED
109 // Report runtime errors and continue.
110 #define DYNAMIC_LINK_WARNING dynamic_link_warning
111 static void dynamic_link_warning( dynamic_link_error_t code, ... ) {
112 (void) code;
113 } // library_warning
114#endif /* !defined(DYNAMIC_LINK_WARNING) && !__TBB_WIN8UI_SUPPORT && __TBB_DYNAMIC_LOAD_ENABLED */
115
116 static bool resolve_symbols( dynamic_link_handle module, const dynamic_link_descriptor descriptors[], size_t required )
117 {
118 if ( !module )
119 return false;
120
121 #if !__TBB_DYNAMIC_LOAD_ENABLED /* only __TBB_WEAK_SYMBOLS_PRESENT is defined */
122 if ( !dlsym ) return false;
123 #endif /* !__TBB_DYNAMIC_LOAD_ENABLED */
124
125 const size_t n_desc=20; // Usually we don't have more than 20 descriptors per library
126 LIBRARY_ASSERT( required <= n_desc, "Too many descriptors is required" );
127 if ( required > n_desc ) return false;
128 pointer_to_handler h[n_desc];
129
130 for ( size_t k = 0; k < required; ++k ) {
131 dynamic_link_descriptor const & desc = descriptors[k];
132 pointer_to_handler addr = (pointer_to_handler)dlsym( module, desc.name );
133 if ( !addr ) {
134 return false;
135 }
136 h[k] = addr;
137 }
138
139 // Commit the entry points.
140 // Cannot use memset here, because the writes must be atomic.
141 for( size_t k = 0; k < required; ++k )
142 *descriptors[k].handler = h[k];
143 return true;
144 }
145
146#if __TBB_WIN8UI_SUPPORT
147 bool dynamic_link( const char* library, const dynamic_link_descriptor descriptors[], size_t required, dynamic_link_handle*, int flags ) {
148 dynamic_link_handle tmp_handle = NULL;
149 TCHAR wlibrary[256];
150 if ( MultiByteToWideChar(CP_UTF8, 0, library, -1, wlibrary, 255) == 0 ) return false;
151 if ( flags & DYNAMIC_LINK_LOAD )
152 tmp_handle = LoadPackagedLibrary( wlibrary, 0 );
153 if (tmp_handle != NULL){
154 return resolve_symbols(tmp_handle, descriptors, required);
155 }else{
156 return false;
157 }
158 }
160 void dynamic_unlink_all() {}
161#else
162#if __TBB_DYNAMIC_LOAD_ENABLED
163/*
164 There is a security issue on Windows: LoadLibrary() may load and execute malicious code.
165 See http://www.microsoft.com/technet/security/advisory/2269637.mspx for details.
166 To avoid the issue, we have to pass full path (not just library name) to LoadLibrary. This
167 function constructs full path to the specified library (it is assumed the library located
168 side-by-side with the tbb.dll.
169
170 The function constructs absolute path for given relative path. Important: Base directory is not
171 current one, it is the directory tbb.dll loaded from.
172
173 Example:
174 Let us assume "tbb.dll" is located in "c:\program files\common\intel\" directory, e. g.
175 absolute path of tbb library is "c:\program files\common\intel\tbb.dll". Absolute path for
176 "tbbmalloc.dll" would be "c:\program files\common\intel\tbbmalloc.dll". Absolute path for
177 "malloc\tbbmalloc.dll" would be "c:\program files\common\intel\malloc\tbbmalloc.dll".
178*/
179
180 // Struct handle_storage is used by dynamic_link routine to store handles of
181 // all loaded or pinned dynamic libraries. When TBB is shut down, it calls
182 // dynamic_unlink_all() that unloads modules referenced by handle_storage.
183 // This struct should not have any constructors since it may be used before
184 // the constructor is called.
185 #define MAX_LOADED_MODULES 8 // The number of maximum possible modules which can be loaded
186
187#if __USE_TBB_ATOMICS
188 typedef ::tbb::atomic<size_t> atomic_incrementer;
189 void init_atomic_incrementer( atomic_incrementer & ) {}
190
191 static void atomic_once( void( *func ) (void), tbb::atomic< tbb::internal::do_once_state > &once_state ) {
192 tbb::internal::atomic_do_once( func, once_state );
193 }
194 #define ATOMIC_ONCE_DECL( var ) tbb::atomic< tbb::internal::do_once_state > var
195#else
196 static void pthread_assert( int error_code, const char* msg ) {
197 LIBRARY_ASSERT( error_code == 0, msg );
198 }
199
200 class atomic_incrementer {
201 size_t my_val;
202 pthread_spinlock_t my_lock;
203 public:
204 void init() {
205 my_val = 0;
206 pthread_assert( pthread_spin_init( &my_lock, PTHREAD_PROCESS_PRIVATE ), "pthread_spin_init failed" );
207 }
208 size_t operator++(int) {
209 pthread_assert( pthread_spin_lock( &my_lock ), "pthread_spin_lock failed" );
210 size_t prev_val = my_val++;
211 pthread_assert( pthread_spin_unlock( &my_lock ), "pthread_spin_unlock failed" );
212 return prev_val;
213 }
214 operator size_t() {
215 pthread_assert( pthread_spin_lock( &my_lock ), "pthread_spin_lock failed" );
216 size_t val = my_val;
217 pthread_assert( pthread_spin_unlock( &my_lock ), "pthread_spin_unlock failed" );
218 return val;
219 }
220 ~atomic_incrementer() {
221 pthread_assert( pthread_spin_destroy( &my_lock ), "pthread_spin_destroy failed" );
222 }
223 };
224
225 void init_atomic_incrementer( atomic_incrementer &r ) {
226 r.init();
227 }
228
229 static void atomic_once( void( *func ) (), pthread_once_t &once_state ) {
230 pthread_assert( pthread_once( &once_state, func ), "pthread_once failed" );
231 }
232 #define ATOMIC_ONCE_DECL( var ) pthread_once_t var = PTHREAD_ONCE_INIT
233#endif /* __USE_TBB_ATOMICS */
234
235 struct handles_t {
236 atomic_incrementer my_size;
237 dynamic_link_handle my_handles[MAX_LOADED_MODULES];
238
239 void init() {
240 init_atomic_incrementer( my_size );
241 }
242
243 void add(const dynamic_link_handle &handle) {
244 const size_t ind = my_size++;
245 LIBRARY_ASSERT( ind < MAX_LOADED_MODULES, "Too many modules are loaded" );
246 my_handles[ind] = handle;
247 }
248
249 void free() {
250 const size_t size = my_size;
251 for (size_t i=0; i<size; ++i)
252 dynamic_unlink( my_handles[i] );
253 }
254 } handles;
255
256 ATOMIC_ONCE_DECL( init_dl_data_state );
257
258 static struct ap_data_t {
259 char _path[PATH_MAX+1];
260 size_t _len;
261 } ap_data;
262
263 static void init_ap_data() {
264 #if _WIN32
265 // Get handle of our DLL first.
266 HMODULE handle;
267 BOOL brc = GetModuleHandleEx(
268 GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
269 (LPCSTR)( & dynamic_link ), // any function inside the library can be used for the address
270 & handle
271 );
272 if ( !brc ) { // Error occurred.
273 int err = GetLastError();
274 DYNAMIC_LINK_WARNING( dl_sys_fail, "GetModuleHandleEx", err );
275 return;
276 }
277 // Now get path to our DLL.
278 DWORD drc = GetModuleFileName( handle, ap_data._path, static_cast< DWORD >( PATH_MAX ) );
279 if ( drc == 0 ) { // Error occurred.
280 int err = GetLastError();
281 DYNAMIC_LINK_WARNING( dl_sys_fail, "GetModuleFileName", err );
282 return;
283 }
284 if ( drc >= PATH_MAX ) { // Buffer too short.
285 DYNAMIC_LINK_WARNING( dl_buff_too_small );
286 return;
287 }
288 // Find the position of the last backslash.
289 char *backslash = strrchr( ap_data._path, '\\' );
290
291 if ( !backslash ) { // Backslash not found.
292 LIBRARY_ASSERT( backslash!=NULL, "Unbelievable.");
293 return;
294 }
295 LIBRARY_ASSERT( backslash >= ap_data._path, "Unbelievable.");
296 ap_data._len = (size_t)(backslash - ap_data._path) + 1;
297 *(backslash+1) = 0;
298 #else
299 // Get the library path
300 Dl_info dlinfo;
301 int res = dladdr( (void*)&dynamic_link, &dlinfo ); // any function inside the library can be used for the address
302 if ( !res ) {
303 char const * err = dlerror();
304 DYNAMIC_LINK_WARNING( dl_sys_fail, "dladdr", err );
305 return;
306 } else {
307 LIBRARY_ASSERT( dlinfo.dli_fname!=NULL, "Unbelievable." );
308 }
309
310 char const *slash = strrchr( dlinfo.dli_fname, '/' );
311 size_t fname_len=0;
312 if ( slash ) {
313 LIBRARY_ASSERT( slash >= dlinfo.dli_fname, "Unbelievable.");
314 fname_len = (size_t)(slash - dlinfo.dli_fname) + 1;
315 }
316
317 size_t rc;
318 if ( dlinfo.dli_fname[0]=='/' ) {
319 // The library path is absolute
320 rc = 0;
321 ap_data._len = 0;
322 } else {
323 // The library path is relative so get the current working directory
324 if ( !getcwd( ap_data._path, sizeof(ap_data._path)/sizeof(ap_data._path[0]) ) ) {
325 DYNAMIC_LINK_WARNING( dl_buff_too_small );
326 return;
327 }
328 ap_data._len = strlen( ap_data._path );
329 ap_data._path[ap_data._len++]='/';
330 rc = ap_data._len;
331 }
332
333 if ( fname_len>0 ) {
334 if ( ap_data._len>PATH_MAX ) {
335 DYNAMIC_LINK_WARNING( dl_buff_too_small );
336 ap_data._len=0;
337 return;
338 }
339 strncpy( ap_data._path+rc, dlinfo.dli_fname, fname_len );
340 ap_data._len += fname_len;
341 ap_data._path[ap_data._len]=0;
342 }
343 #endif /* _WIN32 */
344 }
345
346 static void init_dl_data() {
347 handles.init();
348 init_ap_data();
349 }
350
351 /*
352 The function constructs absolute path for given relative path. Important: Base directory is not
353 current one, it is the directory libtbb.so loaded from.
354
355 Arguments:
356 in name -- Name of a file (may be with relative path; it must not be an absolute one).
357 out path -- Buffer to save result (absolute path) to.
358 in len -- Size of buffer.
359 ret -- 0 -- Error occurred.
360 > len -- Buffer too short, required size returned.
361 otherwise -- Ok, number of characters (incl. terminating null) written to buffer.
362 */
363 static size_t abs_path( char const * name, char * path, size_t len ) {
364 if ( ap_data._len == 0 )
365 return 0;
366
367 size_t name_len = strlen( name );
368 size_t full_len = name_len+ap_data._len;
369 if ( full_len < len ) {
370 __TBB_ASSERT(ap_data._path[ap_data._len] == 0, NULL);
371 strcpy( path, ap_data._path );
372 strcat( path, name );
373 }
374 return full_len+1; // +1 for null character
375 }
376#endif // __TBB_DYNAMIC_LOAD_ENABLED
377
378 void init_dynamic_link_data() {
379 #if __TBB_DYNAMIC_LOAD_ENABLED
380 atomic_once( &init_dl_data, init_dl_data_state );
381 #endif
382 }
383
384 #if __USE_STATIC_DL_INIT
385 // ap_data structure is initialized with current directory on Linux.
386 // So it should be initialized as soon as possible since the current directory may be changed.
387 // static_init_ap_data object provides this initialization during library loading.
388 static struct static_init_dl_data_t {
389 static_init_dl_data_t() {
390 init_dynamic_link_data();
391 }
392 } static_init_dl_data;
393 #endif
394
395 #if __TBB_WEAK_SYMBOLS_PRESENT
396 static bool weak_symbol_link( const dynamic_link_descriptor descriptors[], size_t required )
397 {
398 // Check if the required entries are present in what was loaded into our process.
399 for ( size_t k = 0; k < required; ++k )
400 if ( !descriptors[k].ptr )
401 return false;
402 // Commit the entry points.
403 for ( size_t k = 0; k < required; ++k )
404 *descriptors[k].handler = (pointer_to_handler) descriptors[k].ptr;
405 return true;
406 }
407 #else
408 static bool weak_symbol_link( const dynamic_link_descriptor[], size_t ) {
409 return false;
410 }
411 #endif /* __TBB_WEAK_SYMBOLS_PRESENT */
412
413 void dynamic_unlink( dynamic_link_handle handle ) {
414 #if !__TBB_DYNAMIC_LOAD_ENABLED /* only __TBB_WEAK_SYMBOLS_PRESENT is defined */
415 if ( !dlclose ) return;
416 #endif
417 if ( handle ) {
418 dlclose( handle );
419 }
420 }
421
422 void dynamic_unlink_all() {
423 #if __TBB_DYNAMIC_LOAD_ENABLED
424 handles.free();
425 #endif
426 }
427
428#if !_WIN32
429#if __TBB_DYNAMIC_LOAD_ENABLED
430 static dynamic_link_handle pin_symbols( dynamic_link_descriptor desc, const dynamic_link_descriptor* descriptors, size_t required ) {
431 // It is supposed that all symbols are from the only one library
432 // The library has been loaded by another module and contains at least one requested symbol.
433 // But after we obtained the symbol the library can be unloaded by another thread
434 // invalidating our symbol. Therefore we need to pin the library in memory.
435 dynamic_link_handle library_handle = 0;
436 Dl_info info;
437 // Get library's name from earlier found symbol
438 if ( dladdr( (void*)*desc.handler, &info ) ) {
439 // Pin the library
440 library_handle = dlopen( info.dli_fname, RTLD_LAZY );
441 if ( library_handle ) {
442 // If original library was unloaded before we pinned it
443 // and then another module loaded in its place, the earlier
444 // found symbol would become invalid. So revalidate them.
445 if ( !resolve_symbols( library_handle, descriptors, required ) ) {
446 // Wrong library.
447 dynamic_unlink(library_handle);
448 library_handle = 0;
449 }
450 } else {
451 char const * err = dlerror();
452 DYNAMIC_LINK_WARNING( dl_lib_not_found, info.dli_fname, err );
453 }
454 }
455 // else the library has been unloaded by another thread
456 return library_handle;
457 }
458#endif /* __TBB_DYNAMIC_LOAD_ENABLED */
459#endif /* !_WIN32 */
460
461 static dynamic_link_handle global_symbols_link( const char* library, const dynamic_link_descriptor descriptors[], size_t required ) {
463 dynamic_link_handle library_handle;
464#if _WIN32
465 if ( GetModuleHandleEx( 0, library, &library_handle ) ) {
466 if ( resolve_symbols( library_handle, descriptors, required ) )
467 return library_handle;
468 else
469 FreeLibrary( library_handle );
470 }
471#else /* _WIN32 */
472 #if !__TBB_DYNAMIC_LOAD_ENABLED /* only __TBB_WEAK_SYMBOLS_PRESENT is defined */
473 if ( !dlopen ) return 0;
474 #endif /* !__TBB_DYNAMIC_LOAD_ENABLED */
475 library_handle = dlopen( NULL, RTLD_LAZY );
476 #if !__ANDROID__
477 // On Android dlopen( NULL ) returns NULL if it is called during dynamic module initialization.
478 LIBRARY_ASSERT( library_handle, "The handle for the main program is NULL" );
479 #endif
480 #if __TBB_DYNAMIC_LOAD_ENABLED
481 // Check existence of the first symbol only, then use it to find the library and load all necessary symbols.
482 pointer_to_handler handler;
484 desc.name = descriptors[0].name;
485 desc.handler = &handler;
486 if ( resolve_symbols( library_handle, &desc, 1 ) ) {
487 dynamic_unlink( library_handle );
488 return pin_symbols( desc, descriptors, required );
489 }
490 #else /* only __TBB_WEAK_SYMBOLS_PRESENT is defined */
491 if ( resolve_symbols( library_handle, descriptors, required ) )
492 return library_handle;
493 #endif
494 dynamic_unlink( library_handle );
495#endif /* _WIN32 */
496 return 0;
497 }
498
499 static void save_library_handle( dynamic_link_handle src, dynamic_link_handle *dst ) {
500 LIBRARY_ASSERT( src, "The library handle to store must be non-zero" );
501 if ( dst )
502 *dst = src;
503 #if __TBB_DYNAMIC_LOAD_ENABLED
504 else
505 handles.add( src );
506 #endif /* __TBB_DYNAMIC_LOAD_ENABLED */
507 }
508
509 dynamic_link_handle dynamic_load( const char* library, const dynamic_link_descriptor descriptors[], size_t required ) {
510 ::tbb::internal::suppress_unused_warning( library, descriptors, required );
511#if __TBB_DYNAMIC_LOAD_ENABLED
512
513 size_t const len = PATH_MAX + 1;
514 char path[ len ];
515 size_t rc = abs_path( library, path, len );
516 if ( 0 < rc && rc <= len ) {
517#if _WIN32
518 // Prevent Windows from displaying silly message boxes if it fails to load library
519 // (e.g. because of MS runtime problems - one of those crazy manifest related ones)
520 UINT prev_mode = SetErrorMode (SEM_FAILCRITICALERRORS);
521#endif /* _WIN32 */
522 dynamic_link_handle library_handle = dlopen( path, RTLD_LAZY );
523#if _WIN32
524 SetErrorMode (prev_mode);
525#endif /* _WIN32 */
526 if( library_handle ) {
527 if( !resolve_symbols( library_handle, descriptors, required ) ) {
528 // The loaded library does not contain all the expected entry points
529 dynamic_unlink( library_handle );
530 library_handle = NULL;
531 }
532 } else
533 DYNAMIC_LINK_WARNING( dl_lib_not_found, path, dlerror() );
534 return library_handle;
535 } else if ( rc>len )
536 DYNAMIC_LINK_WARNING( dl_buff_too_small );
537 // rc == 0 means failing of init_ap_data so the warning has already been issued.
538
539#endif /* __TBB_DYNAMIC_LOAD_ENABLED */
540 return 0;
541 }
542
543 bool dynamic_link( const char* library, const dynamic_link_descriptor descriptors[], size_t required, dynamic_link_handle *handle, int flags ) {
544 init_dynamic_link_data();
545
546 // TODO: May global_symbols_link find weak symbols?
547 dynamic_link_handle library_handle = ( flags & DYNAMIC_LINK_GLOBAL ) ? global_symbols_link( library, descriptors, required ) : 0;
548
549 if ( !library_handle && ( flags & DYNAMIC_LINK_LOAD ) )
550 library_handle = dynamic_load( library, descriptors, required );
551
552 if ( !library_handle && ( flags & DYNAMIC_LINK_WEAK ) )
553 return weak_symbol_link( descriptors, required );
554
555 if ( library_handle ) {
556 save_library_handle( library_handle, handle );
557 return true;
558 }
559 return false;
560 }
561
562#endif /*__TBB_WIN8UI_SUPPORT*/
563#else /* __TBB_WEAK_SYMBOLS_PRESENT || __TBB_DYNAMIC_LOAD_ENABLED */
564 bool dynamic_link( const char*, const dynamic_link_descriptor*, size_t, dynamic_link_handle *handle, int ) {
565 if ( handle )
566 *handle=0;
567 return false;
568 }
571#endif /* __TBB_WEAK_SYMBOLS_PRESENT || __TBB_DYNAMIC_LOAD_ENABLED */
572
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
OPEN_INTERNAL_NAMESPACE typedef void(* pointer_to_handler)()
Type definition for a pointer to a void somefunc(void)
Definition: dynamic_link.h:47
const int DYNAMIC_LINK_LOAD
Definition: dynamic_link.h:78
void * dynamic_link_handle
Definition: dynamic_link.h:74
#define CLOSE_INTERNAL_NAMESPACE
Definition: dynamic_link.h:36
const int DYNAMIC_LINK_GLOBAL
Definition: dynamic_link.h:77
dynamic_link_error_t
Definition: dynamic_link.h:108
@ dl_lib_not_found
Definition: dynamic_link.h:110
@ dl_sys_fail
Definition: dynamic_link.h:113
@ dl_buff_too_small
Definition: dynamic_link.h:114
#define OPEN_INTERNAL_NAMESPACE
Definition: dynamic_link.h:35
const int DYNAMIC_LINK_WEAK
Definition: dynamic_link.h:79
#define LIBRARY_ASSERT(x, y)
Definition: dynamic_link.h:28
void dynamic_unlink(dynamic_link_handle)
OPEN_INTERNAL_NAMESPACE bool dynamic_link(const char *, const dynamic_link_descriptor *, size_t, dynamic_link_handle *handle, int)
void dynamic_unlink_all()
#define PATH_MAX
void * addr
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id ITT_FORMAT p const wchar_t int ITT_FORMAT __itt_group_mark d __itt_event ITT_FORMAT __itt_group_mark d void const wchar_t const wchar_t int ITT_FORMAT __itt_group_sync __itt_group_fsync x void const wchar_t int const wchar_t int int ITT_FORMAT __itt_group_sync __itt_group_fsync x void ITT_FORMAT __itt_group_sync __itt_group_fsync p void ITT_FORMAT __itt_group_sync __itt_group_fsync p void size_t ITT_FORMAT lu no args __itt_obj_prop_t __itt_obj_state_t ITT_FORMAT d const char ITT_FORMAT s const char ITT_FORMAT s __itt_frame ITT_FORMAT p __itt_counter ITT_FORMAT p __itt_counter unsigned long long ITT_FORMAT lu __itt_counter unsigned long long ITT_FORMAT lu __itt_counter __itt_clock_domain unsigned long long void ITT_FORMAT p const wchar_t ITT_FORMAT S __itt_mark_type const wchar_t ITT_FORMAT S __itt_mark_type const char ITT_FORMAT s __itt_mark_type ITT_FORMAT d __itt_caller ITT_FORMAT p __itt_caller ITT_FORMAT p no args const __itt_domain __itt_clock_domain unsigned long long __itt_id ITT_FORMAT lu const __itt_domain __itt_clock_domain unsigned long long __itt_id __itt_id void ITT_FORMAT p const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_clock_domain unsigned long long __itt_id __itt_string_handle __itt_scope ITT_FORMAT d const __itt_domain __itt_scope __itt_string_handle const char size_t ITT_FORMAT lu const __itt_domain __itt_clock_domain unsigned long long __itt_relation __itt_id ITT_FORMAT lu __itt_track_group __itt_string_handle __itt_track_group_type ITT_FORMAT d __itt_track ITT_FORMAT p void int const int int const char int ITT_FORMAT d void void const char * path
void const char const char int ITT_FORMAT __itt_group_sync x void const char * name
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t size
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function h
void atomic_do_once(const F &initializer, atomic< do_once_state > &state)
One-time initialization function.
Definition: tbb_misc.h:213
void suppress_unused_warning(const T1 &)
Utility template function to prevent "unused" warnings by various compilers.
Definition: tbb_stddef.h:398
Association between a handler name and location of pointer to it.
Definition: dynamic_link.h:60
pointer_to_handler * handler
Pointer to the handler.
Definition: dynamic_link.h:64
const char * name
Name of the handler.
Definition: dynamic_link.h:62

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.