title: Forcing symbol export with MSVC
body: <p>I have a application and several plugins in DLL files. The plugins use symbols from the
  application via a export library. The application links in several static libraries and this is where most of the symbols come from. This works fine as long as the application uses a symbol. If the symbol is not used there, I get linker errors when compiling the DLL.</p>
  
  <p>How can I force the export of the symbols only used in the plugins?</p>
  
  <p>In order to trigger the export I've tried something like this:</p>
  
  <pre><code>    class MyClassExporter
      {
          MyClass mInstance;
      public:
          MyClassExporter() {}
      };
      static MyClassExporter TheMyClassExporter;
  </code></pre>
  
  <p>in one of the static libs the application is made of to force the export, which didn't work.</p>
  
  <p>In response to Greg (thanks for the answer) and to clarify: The class I want to force the export for is MyClass (which has __declspec(...) defined, depending on wether I want to export or import). MyClassExport was my attempt to force the inclusion of unused (in terms of the application) symbols into the app. I want to 'touch' the symbols so that the linker recognizes them as used and includes them into the application so that it can in turn export these to my plugins. Linking the static libs into the plugins is not an option, since they contain singletons which would be duplicated (app and DLLs each have their own copy of static variables).</p>