title: Exporting functions from a DLL using __declspec(dllexport)
body: <p>I 'm working on a project (VS 2012 solution) including <a href="http://code.msdn.microsoft.com/windowsdesktop/DirectInput-Samples-8ac6f5e3/sourcecode?fileId=57656&amp;pathId=1414531679" rel="nofollow"><code>joystic.cpp</code></a>. Project has been created as DLL, in order to be able to call library from another project. The application receives immediate joypad data in exclusive mode via a dialog timer, displaying them in a dialog box.</p>
  
  <p>I edited the <code>resource.h</code> file with macro:</p>
  
  <pre><code>#ifdef LIBRARY_EXPORTS
  #    define LIBRARY_API __declspec(dllexport)
  #else
  #    define LIBRARY_API __declspec(dllimport)
  #endif
  </code></pre>
  
  <p>in order to be able to export functions by ordering:</p>
  
  <pre><code>LIBRARY_API function();
  </code></pre>
  
  <p>However, should I export all functions of the program, or not?</p>