title: WinAPI function LoadLibrary() causing function failed during execution error
body: <p>The following code loads a dll in runtime using LoadLibrary(). </p>
  
  <pre><code>boolean Load_Internals_dll()
  {
      boolean result = true;
  
      //LOG_INIT;
      HINSTANCE hApexRLIO = LoadLibrary(L"APEX_RLIO_Internals.dll");
  
      printf("Checking getlasterror after loadlibrary:\n",GetLastError());
      if(NULL == hApexRLIO)
      {
          result = false;
          printf("[ERR]:  Unable to load dll\n");
          LOG_PRINT(" [ERR]:  Unable to load dll.\n" );
  
      }
      result = InitRSIDComm_Lib_Func();
      //LOG_EXIT;
      return result;
  }
  </code></pre>
  
  <p>After loading the dll, the handle hApexRLIO is found to be not null, but the function GetLastError() returns system error code 1627 (Function failed during execution). </p>
  
  <p>What could be the possible causes for this error?</p>
  
  <p>There is not much documentation for this error code in the web,
  VC++ ten gallon heads please help me solving this.</p>