Many years ago, I made a mistake to inherit from std :: string in a DLL and put some functions, such as "MakeUpper" in a string. Converting from VS2008 to VS2012 there is a problem with the appearance of npos. With a workaround from microsoft *, I run some other DLL files, but not DLLs that are used with late binding and do not have DLLMain () functions.
* Microsoft workaround
#if _MSC_VER >= 1600
#include <string>
const std::basic_string<char>::size_type std::basic_string<char>::npos = (std::basic_string<char>::size_type) -1;
#endif
The class is declared in the DLL as follows:
class MYDLL_API CNyString : public std::string
this is mistake:
error LNK2001: unresolved external symbol "public: static unsigned int const std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::npos" (?npos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@2IB)
Rewriting the MyString class with the std :: string as attribute does not work, because it is used in several other DLLs, where MyString functions and strings are mixed a lot, also in function parameters. Example:
void Foo(const CMyString &Param_) ..
...
Foo(std::string("Hallo World")..
Does anyone have an idea how to solve this problem? Thanks in advance.