title: Proper way to link static libraries with dll
body: <p>My project builds through few static libraries which should linked to main dll library gain one single dll as a result.</p>
  
  <p>Using <code>__declspec(dllexport)</code> attribute does not lead to appearance of specified functions of static libraries to dll, libraries not linked with dll at all.</p>
  
  <p>Then I tried to build each library as shared for getting proper names of exported functions and created .def file based on them. Using .def file leaded to result. </p>
  
  <ol>
  <li><p>Should <code>__declspec(dllexport)</code> and <code>.def-file</code> act equally in my case?</p></li>
  <li><p>Is it possible to generate a .def file from sources? Since I have C++ code I'm not able to write .def file by myself because of mangling and presence classes in API, the approach described above with temporary generated dlls is inconsistent for production.</p></li>
  </ol>
  
  <h3>Update</h3>
  
  <p>I'd like to explain in detail about the structure of my project. The solution consists of a few projects (modules).</p>
  
  <pre><code>+ 
  |    
  +-+ static_lib1                                          
  |       +                                                
  |       +--+ src                                         
  |                                                        
  +-+ static_lib2                                          
  |       +                                                
  |       +--+ src                                         
  |                                                        
  +-+ dynamic_lib (linked with static_lib1 and static_lib2)
          +                                                
          +--+ src
  </code></pre>
  
  <p>Each sub-project weakly depends on others, let's assume they are not connected for clearness. Each module has own public interface. I want to have all modules as single dynamic library so my artifact is <code>dynamic_lib.dll</code>, but in fact static libraries are not linked with it.</p>