0

HI I am trying to make a dll file that performs its tasks using CUDA library.

Here is a simple version of my code:

CUDADll.cu
`

#include <iostream>
#include "cuda.h"
#include "cuda_runtime.h"
#include "device_launch_parameters.h"

__global__ void test(int a, int b, int* c)
{
    *c = a+b;
}


extern "C" __declspec(dllexport) int sumTEst(int a, int b)
{
    int c = 0;
    test<<<1,1>>>(a, b, &c);
    return c;
}
Inline Code Example Here

`

When I compile this file, there is no problem. But when I build the project which has only file above, an error occurs:

Error   1   error LNK1561: entry point must be defined  C:\svnprojects\IMLibCUDADll\IMLibCUDADll\LINK   IMLibCUDADll

What am I doing wrong? Has anyone done making dll's using GPU?
Thanks in advance..

Devon

3
Contributors
2
Replies
22
Views
4 Years
Discussion Span
Last Post by mark5rockzz_1
0

you should enclose your file with include guards and attach a macro like this:

(as describe in this page)

#if defined(DLL_PROJECT)

 #define DLLAPI __declspec(dllexport)

#else

 #define DLLAPI __declspec(dllimport)

#endif
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.