File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 2020
2121ur_adapter_handle_t_::ur_adapter_handle_t_ () {
2222#ifdef _MSC_VER
23+
2324 // Loading OpenCL.dll increments the libraries internal reference count.
2425 auto handle = LoadLibraryA (" OpenCL.dll" );
2526
@@ -30,17 +31,17 @@ ur_adapter_handle_t_::ur_adapter_handle_t_() {
3031
3132 // So we can safely decrement it here wihtout actually unloading OpenCL.dll.
3233 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);
3734
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.
3839#define CL_CORE_FUNCTION (FUNC ) \
39- FUNC = reinterpret_cast <decltype (::FUNC) *>(dlsym (handle , #FUNC));
40+ FUNC = reinterpret_cast <decltype (::FUNC) *>(dlsym (RTLD_DEFAULT , #FUNC));
4041#include " core_functions.def"
4142#undef CL_CORE_FUNCTION
4243
43- #endif
44+ #endif // _MSC_VER
4445}
4546
4647static ur_adapter_handle_t adapter = nullptr ;
You can’t perform that action at this time.
0 commit comments