Hi,
Is it safe to use one standard compliant STL in a library, and another in a project that uses that library? For example:
//library.h
#include <string> //let's say here it uses minGW STL
void Foo(std::string& str_mingw);
//library.cpp
void Foo(std::string& str_mingw) { /*do something*/ }
//application.cpp
#include "library.h"
#include <string> //let's say here it uses VStudio STL
void Bar()
{
std::string str_vstudio;
Foo(str_vstudio);
//Foo() inside the .lib or .dll uses string from minGW,
//but here a string from VStudio is used
}
It seems to me that bad things will happen, especially if what is used isn't simple string but something more complicated like tr2::thread. But if so, how can I compile a library in one compiler and let the library users freely choose their preferred compiler for their projects?