From b8d5a37bd3ee30c125db206c057f9e824e61a848 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Wed, 24 Jul 2024 18:20:20 +0200 Subject: [PATCH] util/gpu_t.cuh: fix Windows compilation error. --- util/gpu_t.cuh | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/util/gpu_t.cuh b/util/gpu_t.cuh index 8822026..1694055 100644 --- a/util/gpu_t.cuh +++ b/util/gpu_t.cuh @@ -22,7 +22,6 @@ size_t ngpus(); const gpu_t& select_gpu(int id = 0); const cudaDeviceProp& gpu_props(int id = 0); const std::vector& all_gpus(); -extern "C" bool cuda_available(); class event_t { cudaEvent_t event; @@ -347,25 +346,24 @@ public: inline T& operator[](size_t i) { return d_ptr[i]; } }; -extern "C" { -void drop_gpu_ptr_t(gpu_ptr_t&); +#ifdef _WIN32 +# define SPPARK_FFI extern "C" __declspec(dllexport) +#else +# define SPPARK_FFI extern "C" __attribute__((visibility("default"))) +#endif + +SPPARK_FFI bool cuda_available(); +SPPARK_FFI void drop_gpu_ptr_t(gpu_ptr_t&); #ifdef __clang__ # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wreturn-type-c-linkage" #endif -gpu_ptr_t::by_value clone_gpu_ptr_t(const gpu_ptr_t&); +SPPARK_FFI gpu_ptr_t::by_value clone_gpu_ptr_t(const gpu_ptr_t&); #ifdef __clang__ # pragma clang diagnostic pop #endif -} - -#ifdef _WIN32 -# define SPPARK_FFI extern "C" __declspec(dllexport) -#else -# define SPPARK_FFI extern "C" __attribute__((visibility("default"))) -#endif #endif