解决方案:
template class MY_Export std::allocator<char>;
template class MY_Export std::basic_string<char>;
//其中宏:
#ifdef MY_IS_DLL
#define MY_Export __declspec(dllexport)
#else
#define MY_Export __declspec(dllimport)
#endif
原帖没说明原因,正确原因是:
VS2008或之前版本string的函数全部在VC的运行库里实现(链接进去的),
VS2010中string的实现就在头文件里,并且不作为DLL导出函数。