title: cudaMemcpyToSymbol using or not using string
body: <p>I was trying to copy a structure to constant memory in this way:</p>
  
  <pre><code>struct Foo {
      int a, b, c;
  };
  
  __constant__ Foo cData;
  
  int main() {
      Foo hData = {1, 2, 3};
      cudaMemcpyToSymbol(cData, &amp;hData, sizeof(Foo));
      // ...
  }
  </code></pre>
  
  <p>And this worked fine, in my kernel I could access the constant data directly:</p>
  
  <pre><code>__global__ void kernel() {
      printf("Data is: %d %d %d\n", cData.a, cData.b, cData.c); // 1 2 3
  }
  </code></pre>
  
  <p>But then I tried to use a <code>const char *</code> as symbol name, and things stopped working:</p>
  
  <pre><code>cudaMemcpyToSymbol("cData", &amp;hData, sizeof(Foo)); // prints 0 0 0
  </code></pre>
  
  <p>I thought both versions were similar, but it seems I was wrong.</p>
  
  <p>What is happening?</p>
  
  <p>EDIT:
  I'd like to report this same behavior with cudaGetSymbolAddress, which works for me if no <code>const char *</code> is used:</p>
  
  <pre><code>__constant__ int someData[10];
  __constant__ int *ptrToData;
  
  int *dataPosition;
  cudaGetSymbolAddress((void **)&amp;dataPosition, someData); // Works
  // cudaGetSymbolAddress((void **)&amp;dataPosition, "someData"); // Do not work
  cudaMemcpyToSymbol(ptrToData, &amp;dataPosition, sizeof(int *));
  </code></pre>