title: 0xC0000005: Access violation writing location 0x00000000
body: <p>I have a weird problem in building my debug project. I have searched the web but unfortunately I have not found any clue yet.</p>
  
  <p>I'm trying to load a dll in my console application project. My dll has several functions and I just want to call FUNC1 to check if this function works properly.</p>
  
  <p>The declaration of FUNC1 in my dl is :</p>
  
  <pre><code>int FUNC1 (char *inVal, int *retVal)
  </code></pre>
  
  <p>I have successfully loaded the dll in my console application and I call the FUNC1 with function pointer as below:</p>
  
  <pre><code>int main()
  {
  
  HINSTANCE testInstance;
  
  testInstance = LoadLibrary("Path\\to\\my.dll");
  
  
  typedef int (WINAPI *FUNC1Ptr)(char *inVal, int *retVal);
  
  if(testInstance == NULL)
  {
      printf("The dll is not loaded, Please check the path!\n");
  }
  else 
  {
  
      printf("The dll is loaded successfully!!");
  }
  
  FUNC1Ptr FUNC1Lnk = (FUNC1Ptr)GetProcAddress(testInstance,"FUNC1");
  
  if (!FUNC1tLnk)
  {
      FreeLibrary(testInstance);
      printf("Error in getting function address!!\n");
  }
  else
  {
  
      int *ret = 0;
      char *PIN = NULL;
      PIN = "test";
  
      int retVal1 = FUNC1Lnk( PIN, ret );
  
  }
  return 0;
  }
  </code></pre>
  
  <p>PS. The violation is referred to free.c file in:</p>
  
  <pre><code>        retval = HeapFree(_crtheap, 0, pBlock);
      if (retval == 0)
      {
          errno = _get_errno_from_oserr(GetLastError());
      }
  </code></pre>
  
  <p>}</p>