狠狠撸

狠狠撸Share a Scribd company logo
了解 C/C++ 运行
库

         杨 军
主要分享内容


 1   C/C++ 运行库是什么



 2   C/C++ 运行库的功能



 3   如何减小软件的大小
C/C++ 运行库是什么
  每一个 C/C++ 程序,它的背后都有一套庞大的代码来进行支撑,以使得该
程序能够正常运行。这套代码就是 C/C++ 运行库。 C/C++ 运行库由编绎器提
供。

  它主要有两个作用:实现 C/C++ 标准库函数的和实现 C/C++ 语言的一些机
制。
实现 C/C++ 标准库函数
   C/C++ 运行库的大部分代码都是在实现 C,C++ 标准库函
数 , 如 : printf, fopen, malloc, strlen, time, _beginthreadex,
std::string 等。

 1. 标准库函数与 Windows API 的关系
 2. 需要注意的一些函数。
    a. 使用了 TLS 的库函数 , 比如 _localtime64
    b. _beginthreadex 和 CreateThread()
 3. 动态链接 (MD) 与静态链接 (MT) 。
    a: 链接错误,大部分是因为 lib 的编绎方式不一
 致。
    b: 模块间内存释放 , 谁分配谁释放。
实现 C/C++ 语言机制
  C/C++ 运行库实现了 C/C++ 语言自身的一些语言机制,比
如 main 函数进入前全局变量要完成构造。静态变量的只能初
始化一次,异常处理机制等。


1. 全局变量及类中静态成员变量的初始化。

2. 应用程序的入口函数。

3. 静态变量的初始化
如何减小软件的 Size

1. 模块数非常多,使用 MD 编绎

2. 模块数非常少,使用 MT 编绎

3. 使用 VC6 运行库。

4. 不使用 CRT
Thank you !

    推荐书籍 :
  1. 《程序员的自我修养》

  2. 《 windows 核心编
  程》

More Related Content

More from Zoom Quiet (20)

PDF
Go courseday3
Zoom Quiet
?
PDF
Go courseday2
Zoom Quiet
?
PDF
Go courseday1
Zoom Quiet
?
PDF
01s0401 go,互联网时代的c语言 许式伟
Zoom Quiet
?
PDF
Zoz pwned-by-the-owner-表惹程序猿
Zoom Quiet
?
PDF
金山云查询系统改进之路1
Zoom Quiet
?
PDF
Zh120226techparty zd-story
Zoom Quiet
?
PDF
Zh120226techparty velocity2011-review
Zoom Quiet
?
PDF
Zh120226techparty jeff kit-ios-toolbox
Zoom Quiet
?
PPTX
痴别濒辞肠颈迟测2011分享
Zoom Quiet
?
PDF
陈正 Introduction to-sae_python
Zoom Quiet
?
PDF
111218 zhtechparty-panda讲稿
Zoom Quiet
?
PDF
111218 zhtechparty-移动互联网产物需求分析
Zoom Quiet
?
PDF
111218 zhtechparty-zd-浅谈symbian开发
Zoom Quiet
?
PDF
ImpoImport this, that, and the other thing: custom importersrt not for_y
Zoom Quiet
?
PDF
Import this, that, and the other thing: custom importers
Zoom Quiet
?
PPT
金山卫士界面框架
Zoom Quiet
?
KEY
111030 gztechparty-小路-云时代的mysql
Zoom Quiet
?
KEY
111030 gztechparty-小路-sophia
Zoom Quiet
?
PDF
080328 linux2 bsd
Zoom Quiet
?
Go courseday3
Zoom Quiet
?
Go courseday2
Zoom Quiet
?
Go courseday1
Zoom Quiet
?
01s0401 go,互联网时代的c语言 许式伟
Zoom Quiet
?
Zoz pwned-by-the-owner-表惹程序猿
Zoom Quiet
?
金山云查询系统改进之路1
Zoom Quiet
?
Zh120226techparty zd-story
Zoom Quiet
?
Zh120226techparty velocity2011-review
Zoom Quiet
?
Zh120226techparty jeff kit-ios-toolbox
Zoom Quiet
?
痴别濒辞肠颈迟测2011分享
Zoom Quiet
?
陈正 Introduction to-sae_python
Zoom Quiet
?
111218 zhtechparty-panda讲稿
Zoom Quiet
?
111218 zhtechparty-移动互联网产物需求分析
Zoom Quiet
?
111218 zhtechparty-zd-浅谈symbian开发
Zoom Quiet
?
ImpoImport this, that, and the other thing: custom importersrt not for_y
Zoom Quiet
?
Import this, that, and the other thing: custom importers
Zoom Quiet
?
金山卫士界面框架
Zoom Quiet
?
111030 gztechparty-小路-云时代的mysql
Zoom Quiet
?
111030 gztechparty-小路-sophia
Zoom Quiet
?
080328 linux2 bsd
Zoom Quiet
?

110922 knoss-vol26-c++运行库

  • 2. 主要分享内容 1 C/C++ 运行库是什么 2 C/C++ 运行库的功能 3 如何减小软件的大小
  • 3. C/C++ 运行库是什么 每一个 C/C++ 程序,它的背后都有一套庞大的代码来进行支撑,以使得该 程序能够正常运行。这套代码就是 C/C++ 运行库。 C/C++ 运行库由编绎器提 供。 它主要有两个作用:实现 C/C++ 标准库函数的和实现 C/C++ 语言的一些机 制。
  • 4. 实现 C/C++ 标准库函数 C/C++ 运行库的大部分代码都是在实现 C,C++ 标准库函 数 , 如 : printf, fopen, malloc, strlen, time, _beginthreadex, std::string 等。 1. 标准库函数与 Windows API 的关系 2. 需要注意的一些函数。 a. 使用了 TLS 的库函数 , 比如 _localtime64 b. _beginthreadex 和 CreateThread() 3. 动态链接 (MD) 与静态链接 (MT) 。 a: 链接错误,大部分是因为 lib 的编绎方式不一 致。 b: 模块间内存释放 , 谁分配谁释放。
  • 5. 实现 C/C++ 语言机制 C/C++ 运行库实现了 C/C++ 语言自身的一些语言机制,比 如 main 函数进入前全局变量要完成构造。静态变量的只能初 始化一次,异常处理机制等。 1. 全局变量及类中静态成员变量的初始化。 2. 应用程序的入口函数。 3. 静态变量的初始化
  • 6. 如何减小软件的 Size 1. 模块数非常多,使用 MD 编绎 2. 模块数非常少,使用 MT 编绎 3. 使用 VC6 运行库。 4. 不使用 CRT
  • 7. Thank you ! 推荐书籍 : 1. 《程序员的自我修养》 2. 《 windows 核心编 程》