Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions unified-runtime/source/adapters/opencl/adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,15 @@ static ur_adapter_handle_t liveAdapter = nullptr;
ur_adapter_handle_t_::ur_adapter_handle_t_() : handle_base() {
#ifdef _MSC_VER

// Loading OpenCL.dll increments the libraries internal reference count.
auto handle = LoadLibraryA("OpenCL.dll");
// Retrieving handle of an already linked OpenCL.dll library doesn't increase
// the reference count.
auto handle = GetModuleHandleA("OpenCL.dll");
assert(handle);

#define CL_CORE_FUNCTION(FUNC) \
FUNC = reinterpret_cast<decltype(::FUNC) *>(GetProcAddress(handle, #FUNC));
#include "core_functions.def"
#undef CL_CORE_FUNCTION

// So we can safely decrement it here wihtout actually unloading OpenCL.dll.
FreeLibrary(handle);

#else // _MSC_VER

// Use the default shared object search order (RTLD_DEFAULT) since the
Expand Down
Loading