/defaultlib:msvcrt.lib 记得这样编译连接的是精简的VC运行库,居然介绍在MSDN这里C Run-Time Libraries章节,内容如下:
What problems exist if an application uses both msvcrt.dll and msvcr90.dll?
If you have a .lib or .obj file that needs to link to msvcrt.lib, then you should not have to recompile it to work with the new msvcrt.lib in Visual C++ 2008. The .lib or .obj file may rely on the sizes, field offsets, or member function names of various CRT classes or variables, and those should all still exist in a compatible way. When you relink against msvcrt.lib, your final EXE and DLL image will now have a dependency on msvcr90.dll instead of msvcrt.dll.
If you have more than one DLL or EXE, then you may have more than one CRT, whether or not you are using different versions of Visual C++. For example, statically linking the CRT into multiple DLLs can present the same problem. Developers encountering this problem with static CRTs have been instructed to compile with /MD to use the CRT DLL. Now that the CRT DLL has been renamed to msvcr90.dll, applications may have some components linked to msvcrt.dll and others to msvcr90.dll. If your DLLs pass CRT resources across the msvcrt.dll and msvcr90.dll boundary, you will encounter issues with mismatched CRTs and need to recompile your project with Visual C++ 2008.
If your program is using more than one version of the CRT, some care is needed when passing certain CRT objects (such as file handles, locales and environment variables) across DLL boundaries. For more information on the issues involved and how to resolve them, see Potential Errors Passing CRT Objects Across DLL Boundaries.