Help with cudaMallocArray

Hi,
I am working on 16-bit grayscale image data. I have loaded the file using the libtiff library into unsigned short (16-bit) format. I have created cuda descriptor channel and tex* as follows:

texture<unsigned short, 2, cudaReadModeElementType> texImage;
cudaChannelFormatDesc ushort1tex = cudaCreateChannelDesc();

Now I tried to allocate memory in the device equal to the size of the image. h_Src is the array in which I store the image data, imageW and imageH are the width and height of the image respectively.

extern “C”
cudaError_t CUDA_MallocArray(ushort* h_Src, int imageW, int imageH)
{
cudaError_t error;

error = cudaMallocArray(&a_Src, &ushort1tex, imageW, imageH);
error = cudaMemcpyToArray(a_Src, 0, 0,
                          h_Src, imageW * imageH * sizeof(ushort),
                          cudaMemcpyHostToDevice
                          );

return error;

}

When I call cutilSafeCall( CUDA_MallocArray(h_Src, imageW, imageH) ); in the main function,
I am getting the following error:

error: more than one instance of overloaded function “CUDA_MallocArray” has “C” linkage

Can you please suggest why this error occurs and what should I do to remove it? Am I doing anything wrong, I am new to CUDA. Thank you.

Hi,
I figured out the problem. Sorry to bother you. It was my bad. I did not change the type in the declaration.