The problem related to the Warning C4251 'X' needs to have dll-interface to be used by clients of class 'Y' is explained very well here: How can I use Standard Library (STL) classes in my dll interface or ABI?
The reason why it isn't good idea to have lets say std::string as member in a class which is exported from a library is clear for me and it makes sense. However, I don't really understand why it isn't a problem if I use an std::string as an argument type or as a return type?
class DllPort SampleClass
{
private:
std::string privateMember; // Warning C4251
public:
std::string publicMember; // Warning C4251
std::string publicFunction1(); // compiler says it is OK
void publicFunction2(std::string value);// compiler says it is OK
};
I use Visual Studio 2015.