title: Visual Studio C++: When should I be using __declspec(dllimport)?
body: <p>I had a question about DLL building / linking in Visual Studio 2005 and later. Basically my understanding and experience is this:</p>
  
  <p>To build a DLL, I specify the project properties to build a DLL, and then I but __declspec(dllexport) in front of any functions or members that I want to publically expose from the DLL.  Building the project will result in a DLL, a Lib, and a header file that can be deployed as say an API or something.</p>
  
  <p>On the other end, to have your other compiled executable application dynamically link to the DLL  and use its functions, you simply need to have your executable project include the header files and link with the small lib file that was created when the DLL was built.  As long and the compiled application can find the DLL, everything will work.</p>
  
  <p>That has been my experience and that is also how the Microsoft DLL building tutorial described everything on MSDN. I am wondering: is this standard practice? When would you ever need to use __declspec(dllimport) anywhere? Am I missing something?</p>
  
  <p>Thanks!</p>