Fix compilation error on Windows after recent change

This commit is contained in:
Sergey Sharybin 2022-09-13 11:51:51 +02:00
parent 8068b89a68
commit 3c2c296130
1 changed files with 4 additions and 1 deletions

View File

@ -25,10 +25,12 @@ static OneAPIDLLInterface oneapi_dll;
#ifdef _WIN32
# define LOAD_ONEAPI_SHARED_LIBRARY(path) (void *)(LoadLibrary(path))
# define LOAD_ONEAPI_SHARED_LIBRARY_ERROR() GetLastError()
# define FREE_SHARED_LIBRARY(handle) FreeLibrary((HMODULE)handle)
# define GET_SHARED_LIBRARY_SYMBOL(handle, name) GetProcAddress((HMODULE)handle, name)
#elif __linux__
# define LOAD_ONEAPI_SHARED_LIBRARY(path) dlopen(path, RTLD_NOW)
# define LOAD_ONEAPI_SHARED_LIBRARY_ERROR() dlerror()
# define FREE_SHARED_LIBRARY(handle) dlclose(handle)
# define GET_SHARED_LIBRARY_SYMBOL(handle, name) dlsym(handle, name)
#endif
@ -49,7 +51,8 @@ bool device_oneapi_init()
/* This shouldn't happen, but it still makes sense to have a branch for this. */
if (lib_handle == NULL) {
LOG(ERROR) << "oneAPI kernel shared library cannot be loaded: " << dlerror();
LOG(ERROR) << "oneAPI kernel shared library cannot be loaded: "
<< LOAD_ONEAPI_SHARED_LIBRARY_ERROR();
return false;
}