title: Qt application crashes when using DLL, works fine if exported function doesn't declare APIENTRY
body: <p>I built a DLL project in Visual Studio 2010 (by following <a href="https://stackoverflow.com/questions/13218824/how-to-write-a-dll-file-in-c">this post</a>). It contains only one function:</p>
  
  <pre><code>extern "C" __declspec(dllexport) void APIENTRY hello()
  {
      std::cout &lt;&lt; "Hello DLL.\n" &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>Then I created a Qt console application to use that DLL. Its main.cpp contains this:</p>
  
  <pre><code>typedef bool (*f_void)(void);
  
  int main(int argc, char *argv[])
  {
      QCoreApplication a(argc, argv);
  
      QLibrary lib("TestDll");
      f_void hello = (f_void) lib.resolve(QString("hello").toLatin1());
      hello();
  
      return a.exec();
  }
  </code></pre>
  
  <p>When I use <code>APIENTRY</code> in the DLL, the program crashes when calling <code>hello()</code>. It works fine if I remove <code>APIENTRY</code> from <code>hello()</code> declaration though. Why does this happen?</p>