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

Here is a simple version of my code:


#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..


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)


 #define DLLAPI __declspec(dllimport)

This question has already been answered. Start a new discussion instead.