title: CUDA : error C2491: 'log1p' : definition of dllimport function not allowed
body: <p>I am tryint to integrate CUDA in an existing project, in which several libs (DLLs) are created. I started with a very simple kernel that computes a dot product :</p>
  
  <pre><code>// dotProd_kernel.cu
  
  __global__ void dotProd( double* result, double* vec1, double* vec2)
  {
      int i = threadIdx.x;
   result[i] = vec1[i] * vec2[i];
  }
  </code></pre>
  
  <p>This kernel is called by a host script :</p>
  
  <pre><code>// doProd.cu
  
  #include &lt;cutil_inline.h&gt;
  #include &lt;dotProd_kernel.cu&gt;
  
  extern "C" double CUDA_dot(THTensor *vec1, THTensor *vec2);
  
  double CUDA_dot(THTensor *vec1, THTensor *vec2)
  {
      // [content skipped]    
  
      // execute the kernel
      dotProd&lt;&lt;&lt; 1, nbThreads &gt;&gt;&gt;(device_vec1, device_vec2, device_result_array);
  
      // [content skipped]
  
      return sum;
  }
  </code></pre>
  
  <p>I generate build files using cmake, and use Visual Studio 2008 Pro to compile it. If I simply use a .cu file with a foobar function that calls no kernel, it executes fine. But with the above code, I get the following error :</p>
  
  <pre><code>c:\cuda\include\math_functions.h(3459) : error C2491: 'log1p' : definition of dllimport function not allowed
  </code></pre>
  
  <p>The resulting code that calls the CUDA code is exported as a DLL. Is this the problem ? </p>