首页
社区
课程
招聘
[求助]#pragma comment(linker选项问题
发表于: 2012-11-9 10:07 4378

[求助]#pragma comment(linker选项问题

2012-11-9 10:07
4378
请问为什么加上 /defaultlib:msvcrt.lib /OPT:NOWIN98
这2句会影响文件大小呢,谁能告诉我为什么?
我查msdn都查不到请问在哪查,

[课程]FART 脱壳王!加量不加价!FART作者讲授!

收藏
免费 0
支持
分享
最新回复 (3)
雪    币: 1790
活跃值: (3535)
能力值: ( LV6,RANK:90 )
在线值:
发帖
回帖
粉丝
2
/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.

/OPT:NOWIN98  而这个是优化时不需要考虑WIN98操作系统的兼容性,从而优化程度更高,但失去了对WIN98系统的兼容。
2012-11-9 10:19
0
雪    币: 202
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
虽然看不懂英文,还是谢谢了
2012-11-9 15:29
0
雪    币: 962
活跃值: (1691)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
加不加无所谓 vs编译时会自动加
你看看工程设置 然后年vs自动生成的命令行 很多选项就明白了
2012-11-10 01:01
0
游客
登录 | 注册 方可回帖
返回
//