Building dll and link it to a Managed dll

Hi,

I have a solution with two section, an Unmanaged dll which has a CUDA part and a Managed dll that calls the Unmanaged dll.

The problem is when I try to compile it, all the CUDA extensions in .cu files have error. It seems that it can’t find nvcc or VC tries to compile them as an .cpp files.

Here is my build config for .cu files:
(CUDA_BIN_PATH)\nvcc.exe" -ccbin "(VCInstallDir)bin” -c -D_DEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/Od,/Zi,/RTC1,/MTd -I"(CUDA_INC_PATH)" -I./ -I../../common/inc -o (ConfigurationName)$(InputName).obj $(InputFileName)

Is there any missing or wrong flag? :unsure:

Thanks

I’ve been having a similar problem where I build a CUDA application into a DLL and then attempt to use ImportDll in managed code to call the CUDA code. Everything except for the device code gets properly executed.

vidi, are you able to write an all-cuda application? You may just have setup issues, once I got past my own setup-issues and was actually running strait c CUDA apps, then I attempted to call them from managed (I have them in seperate solutions/IDEs).

So you mean, the problem might because of having both managed and unmanaged projects in just one solution? :whistling: