title: Not all functions were exported using dllexport
body: <p>This question might be similar to 
  <a href="https://stackoverflow.com/questions/19791023/dll-exports-not-all-my-functions-are-exported">DLL Exports: not all my functions are exported</a>
  but as it was not fully answered there, I have to ask again. Also my case is because of the use of templates and exporting the whole classes slightly different.</p>
  
  <p>Used environment: VS2008, cl9.0.</p>
  
  <p>I have created a dll-project and added about 40 files (each class a file), mainly headers, because a lot of the classes are templates. An example of the heritage would be:</p>
  
  <pre><code>// Class1.h
  template&lt;class TYPE&gt;
  class TInt
  {
      // Some member functions here
      // Also a function bool IsValid() const;
  };
  // Implementation of template here in the header
  
  // Class2.h
  #ifndef DllExpImpM
  #define DllExpImpM __declspec(dllimport)
  #endif
  
  class DllExpImpM CInt : public TInt&lt;double&gt; 
  { 
      // Some member functions here
  };
  
  // Class2.cpp
  // Some includes, including "stdafx.h", which sets DllExpImpM 
  // to __declspec(dllexport)
  template class DllExpImpM TInt&lt;double&gt;;
  // Implemenation of CInt
  </code></pre>
  
  <p>So far, it worked fine as long as I used the debug (compile) option. I was able the use the dll project from other projects.</p>
  
  <p>But if the dll projekt is compiled as release (which works fine), I cannot use it from other projects, because the compiler complains that are some missing functions, e.g. that IsValid() in TInt. I used the dependency walker to check it, and indeed, the compiler is right! The member function IsValid() was not exported, along with another function and with a constructor und the destructor. All other member functions of TInt are exported, I can see them using the dependency walker, I can use them from other projects. This also happens in a similar way with one other class.</p>
  
  <p>I then compared the debug dll and the release dll using the dependency walker and winmerge. They are almost identical, just that the release dll is missing a few functions (about 3 %).</p>
  
  <p>I have no idea what is wrong. I know that I do not have a lot information (the whole information is much too big and I yet could not find a simple example that does not work) and to me all sounds a little bit weird. But perhaps anyone out there once had the same problem. I appreciate every idea very much.</p>
  
  <p>Thank you!</p>