官术网_书友最值得收藏!

  • Extreme C
  • Kamran Amini
  • 505字
  • 2021-03-26 16:15:39

Chapter 03 Object Files

This chapter details the various products that a C/C++ project can have. Possible products include relocatable object files, executable object files, static libraries, and shared object files. However, relocatable object files are considered to be temporary products and they act as ingredients for making other types of products that are final.

It seems that today in C, it's crucial to have further discussion about the various types of object files and their internal structures. The majority of C books only talk about the C syntax and the language itself; but, in real-world you need more in-depth knowledge to be a successful C programmer.

When you are creating software, it is not just about the development and the programming language. In fact, it is about the whole process: writing the code, compilation, optimization, producing correct products, and further subsequent steps, in order to run and maintain those products on the target platforms.

You should be knowledgeable about these intermediate steps, to the extent that you are able to solve any issues you might encounter. This is even more serious regarding embedded development, as the hardware architectures and the instruction sets can be challenging and atypical.

This chapter is divided into the following sections:

  1. Application binary interface: Here, we are first going to talk about the Application Binary Interface (ABI) and its importance.
  2. Object file formats: In this section, we talk about various object file formats that exist today or they have become obsolete over the years. We also introduce ELF as the most used object file format in Unix-like systems.
  3. Relocatable object files: Here we discuss relocatable object files and the very first products of a C project. We take a look inside ELF relocatable object files to see what we can find there.
  4. Executable object files: As part of this section, we talk about the executable object files. We also explain how they are created from a number of relocatable object files. We discuss the differences between ELF relocatable and executable object files in terms of their internal structure.
  5. Static library: In this section, we talk about static libraries and how we can create them. We also demonstrate how to write a program and use already built static libraries.
  1. Dynamic library: Here we talk about shared object files. We demonstrate how to create them out of a number of relocatable object files and how to use them in a program. We also briefly talk about the internal structure of an ELF shared object file.

Our discussions in this chapter will be mostly themed around Unix-like systems, but we will discuss some differences in other operating systems like Microsoft Windows.

Note:

Before moving on to read this chapter, you need to be familiar with the basic ideas and steps required for building a C project. You need to know what a translation unit is and how linking is different from compilation. Please read the previous chapter before moving on with this one.

Let's begin the chapter by talking about ABI.

主站蜘蛛池模板: 五指山市| 龙川县| 错那县| 和平县| 兰州市| 余姚市| 张家界市| 德保县| 黔西县| 南澳县| 铅山县| 和顺县| 邮箱| 鹤庆县| 桐梓县| 平乐县| 黄梅县| 宁津县| 余江县| 东明县| 新和县| 九寨沟县| 台南县| 乐昌市| 天津市| 盐边县| 扬州市| 紫阳县| 嘉兴市| 英吉沙县| 千阳县| 大悟县| 且末县| 安远县| 祥云县| 富顺县| 沧源| 广宁县| 微山县| 阳原县| 西华县|