Can you compile a Windows dll with nvcc CUDA?

(warning, newbie here! :"> )

I wonder whether you could compile CUDA applications into windows dlls. The reason being, I would like to share some given function (say a bitonic sort) among various callers or among various modules in a system without having to recompile it with the rest of the code everytime.

If it is possible what is the way to do it? (I noticed a “lib” option in nvcc command line, but that is not really a dll, is it?)

Yes you can. But you’ll need to redistribute cudart.dll if you’re using Runtime API.

Thanks.

Is there any example or template available anywhere?

My specific issue is how to compile the dll project using nvcc. What compile/link options should one use?

Nevermind, I got it.

For the record, install the CUDA SDK and study project “template”.

Change the project configuration to generate a .lib output.

Not quite a dll but is enough for what I desired.