std::vector needs to have dll-interface to be used by clients of class 'X<T> warning
Solution 1:
Exporting from a DLL is platform-specific. You will have to fix this for Windows (basically use declspec(dllexport/dllimport)
on the instantiated class template) and encapsulate the required code in your Windows-specific preprocessor macro.
My experience is that exporting STL classes from DLLs on Windows is fraught with pain, generally I try to design the interface such that this is not needed.
Solution 2:
One fix is relying on dynamic allocation/deallocation of the STL structures. So:
class EXPORTED ExportedClass
{
private:
std::vector<int> *_integers;
public:
ExportedClass()
{
_integers = new std::vector<int>();
}
~ExportedClass()
{
delete _integers;
}
};
won't give any warning and it's more safe in case you are distributing the same binary (the dll) that has to be used with different version of the compiler that may has different versions of the STL. In this way you have 100% guarantee that sizeof(ExportedClass)
is always the same.
Solution 3:
You could just export the members, which the dll-clients need to access. To do this remove the export declaration from the class declaration and add it to each individual member function you want to export.
EDIT:
In your case you should probably not try to export the class (leave out AGUI_CORE_DECLSPEC) since it is a template class. Provide all methods in your header as inline and it will work.
If you do not want this, some compilers provide a special way to export template classes. But you will have to specify the template parameter for this.
Solution 4:
The usual method of dealing with platform specific stuff like this is to try and restrict all platform specific settings to a handful of low level files/classes, and then use #defines and #ifdef/#ifndef preprocessor directives to add/replace platform specific variations.
To effectively implement this, you may need an abstraction layer. For example a production system I worked on in the 1990s had a "File System" library. This presented a common interface to the applications and production code, but had to rely on a few platform-specific files. As well as making it easier to compile and maintain, it also made it easier to port to new platforms. A new file hardware vendor or OS flavour? Simply add the settings to the include files and add new directives accordingly.