I have a simple function like this:
cusp.dll
#define EXPORT extern "C" __declspec (dllexport)
EXPORT 
void cuspDsolver(int *r, int *c, double *v, double *x, double *b, int size, int nnz,double tol)
{
    .
    .
    .
    .
    .
}
and I created a dll using these two lines:
#define EXPORT extern "C" __declspec (dllexport)
EXPORT 
and I called this function in other Project using this method:
HINSTANCE hDLL = LoadLibrary("C:\\Users\\Administrator\\Documents\\Visual Studio           2012\\Projects\\Ardalan_12\\cusp.dll");
if(hDLL == NULL)
{
    cout<< "Failed to load DLL" <<endl;
}
typedef void(*fnPtr)(int *, int *, double *, double *, double *, int , int ,double);
fnPtr pfn;
pfn=(fnPtr)GetProcAddress(hDLL,"cuspDsolver");
if(pfn)
{
    pfn(rowOffset,colIndex,values,answer,rightHandSide,theSize,nnz,0.9);
}
FreeLibrary(hDLL);
this works very fine, but now I changed my function to this
//#define EXPORT extern "C" __declspec (dllexport)
//EXPORT 
template <typename LinearOperator,typename Vector>
void cuspDsolver(LinearOperator& A,Vector& X,Vector& B,double tol)
{
    cusp::default_monitor<double> monitor(B, 10000, tol);
    cusp::precond::scaled_bridson_ainv<double,cusp::device_memory> PRE(A);
    DWORD dw1 = GetTickCount();
    cusp::krylov::cg(A,X,B,monitor,PRE);
    DWORD dw2 = GetTickCount();
    double dw3 = dw2 - dw1;
    cout <<endl << "time spent is : " << dw3 << endl;
    cout << endl << "developed by cusp!!!"  << endl;
}
but Visual Studio won't allow extern "C" __declspec (dllexport) with template functions is there any way to do this easily?actually I'm not expert,so would you please explain this to me in detail?
 
     
     
     
    