nvidia/cuda: Use reinterpret_case instead of static_cast

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2021-02-14 13:27:52 +01:00
parent 01f16e6d1f
commit b0ac0b724a

View file

@ -29,19 +29,19 @@
#define CUDA_LOAD_SYMBOL(NAME) \ #define CUDA_LOAD_SYMBOL(NAME) \
{ \ { \
NAME = static_cast<decltype(NAME)>(os_dlsym(_library, #NAME)); \ NAME = reinterpret_cast<decltype(NAME)>(os_dlsym(_library, #NAME)); \
if (!NAME) \ if (!NAME) \
throw std::runtime_error("Failed to load '" #NAME "' from '" CUDA_NAME "'."); \ throw std::runtime_error("Failed to load '" #NAME "' from '" CUDA_NAME "'."); \
} }
#define CUDA_LOAD_SYMBOL_V2(NAME) \ #define CUDA_LOAD_SYMBOL_V2(NAME) \
{ \ { \
NAME = static_cast<decltype(NAME)>(os_dlsym(_library, #NAME "_v2")); \ NAME = reinterpret_cast<decltype(NAME)>(os_dlsym(_library, #NAME "_v2")); \
if (!NAME) \ if (!NAME) \
throw std::runtime_error("Failed to load '" #NAME "' from '" CUDA_NAME "'."); \ throw std::runtime_error("Failed to load '" #NAME "' from '" CUDA_NAME "'."); \
} }
#define CUDA_LOAD_SYMBOL_EX(NAME, OVERRIDE) \ #define CUDA_LOAD_SYMBOL_EX(NAME, OVERRIDE) \
{ \ { \
NAME = static_cast<decltype(NAME)>(os_dlsym(_library, #OVERRIDE)); \ NAME = reinterpret_cast<decltype(NAME)>(os_dlsym(_library, #OVERRIDE)); \
if (!NAME) \ if (!NAME) \
throw std::runtime_error("Failed to load '" #NAME "' from '" CUDA_NAME "'."); \ throw std::runtime_error("Failed to load '" #NAME "' from '" CUDA_NAME "'."); \
} }