Recently I want implement a sparse linear solver in Mathematica with cuda, and I found the following resource: calling CUDA library functions. As it shows, I tried to use CreateLibrary function to export the example Mathematica\10.4\SystemFiles\Links\CUDALink\CSource\addTwo.cu to a dll file. However, I faced link errors.
tmpxft_ 00002fa4_ 00000000-28_addTwo.obj : error LNK2019: unresolved external symbol CUDA_Runtime_getDeviceMemoryAsMInteger referenced in function "int __cdecl iAddTwo(struct st_WGL_Memory_p_t *,struct st_WGL_Memory_p_t *)" (?iAddTwo@@YAHPEAUst_WGL_Memory_p_t@@0@Z)
CUDA_Runtime_getDeviceMemoryAsMInteger in my opinion is get device pointer from a wgl object which wrap a cudamemory data. So the pointer can be used in traditional cuda c/c++ functions. The errors imply that it possibly is lacking a lib file implementing CUDA_Runtime_getDeviceMemoryAsMInteger, but I only found the statement in
#define CUDA_Runtime_getDeviceMemoryAsMInteger(mem) ((mint *) CUDA_Runtime_getDeviceMemory(mem)). I also replaced
(mint *) CUDA_Runtime_getDeviceMemory in the cu file, but it showed the similar problem that
...unresolved external symbol CUDA_Runtime_getDeviceMemory referenced in....
Could someone help me?