   [C++ Win32] DLL Templates and Static Members
  Using Microsoft Visual Studio 7.1 (2003)I have quite a few templated classes in a DLL and some have static members.  I cannot find a way to resolve the linking errors that crop up when I use the template classes in an application using the DLL.  Explicit instantiation is not an option as I need custom data types from the application to fill the templates.  The classes with static members cause even more issues.  If I initialize the static members within the template's header file the dll links fine but the app comes up with errors.  If I initialize it in a source file the dll doesn't link correctly but the app does (after explicity initializing to get the dll to compile).I know that this has been a painful issue for quite some time, but nowhere have I found a final, usable solution that will work around this crappy bug.  Has anyone ever found a work around?I'll post some code and specific errors if needed.   
Quote:Explicit instantiation is not an option as I need custom data types from the application to fill the templates.A template never becomes part of a library or executable. Only the classes and functions that are instanciated from the template are. There is no workaround.This is why the bulk of the C++ Standard Library is provided in source form.Or did I misunderstand your question?   ;  Template classes + DLLs = bad juju.In any case, if I understand what you're asking, you can get the application and the DLL to agree on a static member variable location by exporting the instances of the template class from the DLL.  Here is an article describing the syntax necessary.However, I strongly suggest rethinking your design. Because, as I've said, template classes + DLLs = bad juju.