Skip to content

Commit

Permalink
Merge pull request #956 from IntelPython/use-error-handle-in-getSymbol
Browse files Browse the repository at this point in the history
Use error_handler if getSymbol encountered error and returns nullptr
  • Loading branch information
oleksandr-pavlyk authored Nov 2, 2022
2 parents 2f7062a + f24aa12 commit 85ec499
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libsyclinterface/helper/include/dpctl_dynamic_lib_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

#endif // __linux__

#include "dpctl_error_handlers.h"
#include <cstdint>

namespace dpctl
Expand Down Expand Up @@ -76,12 +77,18 @@ class DynamicLibHelper final
char *error = dlerror();

if (nullptr != error) {
error_handler("Could not retrieve symbol " + std::string(symName) +
". Error encountered: " + std::string(error),
__FILE__, __func__, __LINE__);
return nullptr;
}
#elif defined(_WIN32) || defined(_WIN64)
void *sym = (void *)GetProcAddress((HMODULE)_handle, symName);

if (nullptr == sym) {
error_handler("Could not retrieve symbol " + std::string(symName) +
".",
__FILE__, __func__, __LINE__);
return nullptr;
}
#endif
Expand Down

0 comments on commit 85ec499

Please sign in to comment.