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

A DLL is made for windows.. It is going to require you to specify a main..

int main() for consoles
WinMain for Win32-GUI
DLLMain for DLL's

int WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
    switch(dwReason)
    {
        case DLL_PROCESS_ATTACH:
        {
            break;
        }

        case DLL_PROCESS_DETACH:
        {
            break;
        }
    }
    return true;
}

http://msdn.microsoft.com/en-ca/library/windows/desktop/ms682583(v=vs.85).aspx

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