Proper way to define class with CUDA dependency in header

I have a class used by other developers, I provide them a header file that describe the member functions but not the variables because there’s some CUDA dependent type like cudaStream_t and they are not using nvcc,
so now I have to maintain class declaration in both source file and header file.

I’m wondering if there’s a way to fix this without changing other developer’s compiler configuration, thanks!

cudaStream_t doesn’t require use of nvcc

No it doesn’t but it needs cuda_runtime.h and I have to change other guys makefile for that.
Any way to use POD to represent cudaStream_t?
Thanks.

looks like cudaStream_t is a pointer (refer to the thread linked below)

So a pointer to void might serve well as a placeholder.

Or maybe this construct might work (it doesn’t define the internals of CUStream_st, but declares that such a struct exists)

struct CUStream_st;
typedef struct CUStream_st *cudaStream_t;

We had the same problem, we store the cudaStream_t also in a void* pointer, in order to get rid of the cuda (header file) dependency. For other types defined in the cuda header file, you might have to take a look (and be aware that the repreenation of these types might change for a future toolkit version)