Skip to content

Commit 4692f4e

Browse files
Use error_handler if getSymbol encountered error and returns nullptr
1 parent 36c8f71 commit 4692f4e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

libsyclinterface/helper/include/dpctl_dynamic_lib_helper.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#endif // __linux__
4040

4141
#include <cstdint>
42+
#include "dpctl_error_handlers.h"
4243

4344
namespace dpctl
4445
{
@@ -76,12 +77,23 @@ class DynamicLibHelper final
7677
char *error = dlerror();
7778

7879
if (nullptr != error) {
80+
error_handler(
81+
"Could not retrieve symbol "
82+
+ std::string(symName)
83+
+ ". Error encountered: "
84+
+ std::string(error), __FILE__, __func__, __LINE__
85+
);
7986
return nullptr;
8087
}
8188
#elif defined(_WIN32) || defined(_WIN64)
8289
void *sym = (void *)GetProcAddress((HMODULE)_handle, symName);
8390

8491
if (nullptr == sym) {
92+
error_handler(
93+
"Could not retrieve symbol "
94+
+ std::string(symName)
95+
+ ".", __FILE__, __func__, __LINE__
96+
);
8597
return nullptr;
8698
}
8799
#endif

0 commit comments

Comments
 (0)