When you create a structure in your public interface in MSVC that contains a templated data element, you will receive a warning at compile time.
One solution is to export the template type to your DLL (see this article in KB format).
I ask this question because I do not understand why you want to export this type?
If you do not export it, the .hpp files have enough information to generate the type yourself.
If this is a standard type of library and you have 2 or more dlls, each of which is potentially associated with a different version of the standard library, now you have several binary versions of the same types in your code.
What's the point? Case # 1 can lead to runtime crashes if there really are two different versions that, according to the compiler, are the same, but # 2 might just not load due to missing characters?
Am I completely out of here? In my opinion, the best option is to simply ignore warnings from MSVC.
EDIT: so far no one has pointed this out, but I know and understand that if you have statics in your templates and you want these statics to be available for all kinds of uses of your DLL inside one application: you should, in this case export the template instance. This is important in the case of single-user objects and registrars, etc.
source share