2727
2828#if defined(__linux__) || defined(_WIN32) || defined(_WIN64)
2929
30- #ifdef __linux__
30+ #ifdef __linux__
3131
32- #include < dlfcn.h>
32+ #include < dlfcn.h>
3333
34- #elif defined(_WIN32) || defined(_WIN64)
34+ #elif defined(_WIN32) || defined(_WIN64)
3535
36- #define NOMINMAX
37- #include < windows.h>
36+ #define NOMINMAX
37+ #include < windows.h>
3838
39- #endif // __linux__
39+ #endif // __linux__
4040
4141#include < cstdint>
4242
@@ -46,51 +46,48 @@ namespace dpctl
4646class DynamicLibHelper final
4747{
4848public:
49- DynamicLibHelper () = delete ;
49+ DynamicLibHelper () = delete ;
5050 DynamicLibHelper (const DynamicLibHelper &) = delete ;
51- DynamicLibHelper (const char * libName, int flag)
51+ DynamicLibHelper (const char *libName, int flag)
5252 {
5353
54- #ifdef __linux__
54+ #ifdef __linux__
5555 _handle = dlopen (libName, flag);
56- #elif defined(_WIN32) || defined(_WIN64)
56+ #elif defined(_WIN32) || defined(_WIN64)
5757 _handle = LoadLibraryA (libName);
58- #endif
58+ #endif
5959 }
6060
6161 ~DynamicLibHelper ()
6262 {
63- #ifdef __linux__
63+ #ifdef __linux__
6464 dlclose (_handle);
65- #elif defined(_WIN32) || defined(_WIN64)
65+ #elif defined(_WIN32) || defined(_WIN64)
6666 FreeLibrary ((HMODULE)_handle);
67- #endif
67+ #endif
6868 };
6969
70- template <typename T>
71- T getSymbol (const char * symName)
70+ template <typename T> T getSymbol (const char *symName)
7271 {
73- #ifdef __linux__
74- void * sym = dlsym (_handle, symName);
75- char * error = dlerror ();
72+ #ifdef __linux__
73+ void *sym = dlsym (_handle, symName);
74+ char *error = dlerror ();
7675
77- if (NULL != error)
78- {
76+ if (NULL != error) {
7977 return nullptr ;
8078 }
81- #elif defined(_WIN32) || defined(_WIN64)
82- void * sym = (void *)GetProcAddress ((HMODULE)_handle, symName);
79+ #elif defined(_WIN32) || defined(_WIN64)
80+ void *sym = (void *)GetProcAddress ((HMODULE)_handle, symName);
8381
84- if (NULL == sym)
85- {
82+ if (NULL == sym) {
8683 return nullptr ;
8784 }
88- #endif
85+ #endif
8986
9087 return (T)sym;
9188 }
9289
93- bool opened () const
90+ bool opened () const
9491 {
9592 if (!_handle)
9693 return false ;
@@ -99,7 +96,7 @@ class DynamicLibHelper final
9996 }
10097
10198private:
102- void * _handle = nullptr ;
99+ void *_handle = nullptr ;
103100};
104101
105102} // namespace dpctl
0 commit comments