File tree 1 file changed +7
-6
lines changed
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 20
20
21
21
ur_adapter_handle_t_::ur_adapter_handle_t_ () {
22
22
#ifdef _MSC_VER
23
+
23
24
// Loading OpenCL.dll increments the libraries internal reference count.
24
25
auto handle = LoadLibraryA (" OpenCL.dll" );
25
26
@@ -30,17 +31,17 @@ ur_adapter_handle_t_::ur_adapter_handle_t_() {
30
31
31
32
// So we can safely decrement it here wihtout actually unloading OpenCL.dll.
32
33
FreeLibrary (handle);
33
- #else
34
- // Loading libOpenCL.so to get the library handle but don't dlclose it as
35
- // this causes a segfault when attempting to call any OpenCL entry point.
36
- auto handle = dlopen (" libOpenCL.so" , RTLD_LOCAL);
37
34
35
+ #else // _MSC_VER
36
+
37
+ // Use the default shared object search order (RTLD_DEFAULT) since the
38
+ // OpenCL-ICD-Loader has already been loaded into the process.
38
39
#define CL_CORE_FUNCTION (FUNC ) \
39
- FUNC = reinterpret_cast <decltype (::FUNC) *>(dlsym (handle , #FUNC));
40
+ FUNC = reinterpret_cast <decltype (::FUNC) *>(dlsym (RTLD_DEFAULT , #FUNC));
40
41
#include " core_functions.def"
41
42
#undef CL_CORE_FUNCTION
42
43
43
- #endif
44
+ #endif // _MSC_VER
44
45
}
45
46
46
47
static ur_adapter_handle_t adapter = nullptr ;
You can’t perform that action at this time.
0 commit comments