title: curl_easy_escape not working from C++ dll
body: <p>I am having trouble using the <code>curl_easy_escape</code> function in a C++ dll.  If I create a console application, <code>curl_easy_escape</code> works as expected.</p>
  
  <p>cURL curl-7.28.1-devel-mingw32<br>
  Visual Studio 2010</p>
  
  <p><strong>Console Application (working as expected)</strong></p>
  
  <pre><code>int _tmain(int argc, _TCHAR* argv[])
  {
      CURL *curl;
      char *data1;
      char *data2;
      int data2len;
  
      curl = curl_easy_init();
      if (curl)
      {
          data1 = curl_easy_escape(curl, "this is a string with spaces", 0);
          printf("\r\ndata1 = %s\r\n", data1);
          data2 = curl_easy_unescape(curl, data1, 0, &amp;data2len);
          printf("\r\ndata2 = %s\r\n", data2);
          curl_easy_cleanup(curl);
      }
      printf(“\r\nPress any key to continue\r\n”);
      return 0;
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <pre><code>data1 = this%20is%20a%20string%20with%20spaces
  data2 = this is a string with spaces
  Press any key to continue
  </code></pre>
  
  <p><strong>C++ DLL</strong> </p>
  
  <p>Visual C++ > Win32 > Win32 Project<br>
  Application type = DLL (all other options as default)<br>
  Linker > Input > Additional Dependencies, added libcurl.lib  </p>
  
  <pre><code>extern "C"
  {
      __declspec(dllexport) int * curl_test(char *sBuf)
      {
          CURL *curl;
          curl = curl_easy_init();
          if (curl)
          {
              // The following line does not work
              //strcpy(sBuf, curl_easy_escape(curl, "this is a string with spaces", 0));
  
              // This line does work
              strcpy(sBuf, "this is a string with spaces");
  
              curl_easy_cleanup(curl);
          }
          return 0;
  
      }
  }
  </code></pre>
  
  <p>The dll is used in a C program and calls <code>curl_test</code> with <code>char ptr[256]</code>.  With <code>curl_easy_escape</code> in place, the <code>LoadLibrary</code> call fails:</p>
  
  <pre><code>Error: C interpreter run time error: Error -- File error : LoadLibrary(mydll.dll) failed : The specified procedure could not be found.
  </code></pre>
  
  <p>Note that this is on the <code>LoadLibrary</code>, so the <code>curl_test</code> function has not been called yet.</p>
  
  <p>I suppose I can find some URL encode/decode functions, but would prefer to use what cURL already offers.  I also have the same issue with the <code>curl_easy_strerror</code> function.  </p>
  
  <p>Could it be the ‘const char *’?</p>
  
  <p><strong>Update</strong></p>
  
  <p>Ideally I would like to use <code>curl_easy_escape/curl_easy_unescape</code>, but as a workaround I decided to implement my own URL encoding/decoding in C.  I found efficient, well written encoding/decoding functions at <a href="http://www.geekhideout.com/urlcode.shtml" rel="nofollow">http://www.geekhideout.com/urlcode.shtml</a></p>