I’m attempting to link a host of existing c++ code with a cuda kernel incl. wrapper for it.
I’ve done a little test that resembles what I’m attempting to do. At this stage my problem is the -shared option given to g++.
In the “real” project g++ creates a dll and when I try to link with a cudaobject file I get a lot of these kinds of errors:
Cannot export ??$cudaLaunch@D@@YA?AW4cudaError@@PAD@Z: symbol not found
In my testproject I have recreated the problem. I have created a cudaobject file using nvcc with -c option and a main.o file with g++ using the -c option.
When I try to link them together, this line works just fine:
g++ -o runme Main.o KernelAndWrapper.obj -L"D:\CUDA\v3.2\lib\Win32" -lcuda -lcudart
But this fails with the above mentioned kind of error:
g++ -shared -o runme.dll Main.o KernelAndWrapper.obj -L"D:\CUDA\v3.2\lib\Win32" -lcuda -lcudart
So I guess I need to do something about my cuda code, when it’s going to be compiled with the -shared option, but what?
I’m using win7 64bit with minGW gcc.