title: Windows & C++: extern & __declspec(dllimport)
body: <p>What is the difference/relationship between "extern" and "__declspec(dllimport")? I found that sometimes it is necessary to use both of them, sometimes one is enough.</p>
  
  <p>Am I right that:</p>
  
  <ol>
  <li>"extern" is for statically linked libraries,</li>
  <li>"__declspec(dllimport)" is for DLL (dynamically linked libraries),</li>
  <li>both do actually the same job for their respective type of linking,</li>
  <li>you need to use both when you use import libraries (small .lib files that help linking with dll)?</li>
  </ol>