动态链接到CRT和静态链接到CRT的区别是什么

zyTech001 2009-01-01 05:50:00
动态链接到CRT和静态链接到CRT的区别是什么
...全文
491 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
ps_edison 2009-08-04
  • 打赏
  • 举报
回复
dd
xiaoyisnail 2009-01-01
  • 打赏
  • 举报
回复
lz问的是不是就是动态链接和静态链接的区别啊?
星羽 2009-01-01
  • 打赏
  • 举报
回复
星羽 2009-01-01
  • 打赏
  • 举报
回复
动态链接
/MD
Causes your application to use the multithread- and DLL-specific version of the run-time library. Defines _MT and _DLL and causes the compiler to place the library name MSVCRT.lib into the .obj file.

Applications compiled with this option are statically linked to MSVCRT.lib. This library provides a layer of code that allows the linker to resolve external references. The actual working code is contained in MSVCR80.DLL, which must be available at run time to applications linked with MSVCRT.lib.

When /MD is used with _STATIC_CPPLIB defined (/D_STATIC_CPPLIB) it will cause the application to link with the static multithread Standard C++ Library (libcpmt.lib) instead of the dynamic version (msvcprt.lib) while still dynamically linking to the main CRT via msvcrt.lib.

静态链接
/MT
Causes your application to use the multithread, static version of the run-time library. Defines _MT and causes the compiler to place the library name LIBCMT.lib into the .obj file so that the linker will use LIBCMT.lib to resolve external symbols.
wiowei 2009-01-01
  • 打赏
  • 举报
回复
区别就是运行时前者需要系统安装了CRT的dll,一个不需要
baihacker 2009-01-01
  • 打赏
  • 举报
回复
都要加个lib.
在这个lib里面:
1.把任务交给dll,而自己只有一些链接符号等,在连接的时候就只要知道这些链接符号就行了,通过dll加载时的函数重定位,然后调用函数,二进制代码在DLL里,所以程序比较少,这是动态的
2.自己不仅有链接符号,还有函数的实现的二进制代码,在链接的时候,就知道这些二进制代码的位置了,这些二进制代码在应用程序里,因为程序比较大,这是静态的.

65,178

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧