Advanced C and C++ Compiling
Learning how to write C/C++ code is only the first step. To be a serious programmer, you need to understand the structure and purpose of the binary files produced by the compiler: object files, static libraries, shared libraries, and, of course, executables.
Advanced C and C++ Compiling explains the build process in detail and shows how to integrate code from other developers in the form of deployed libraries as well as how to resolve issues and potential mismatches between your own and external code trees.
With the proliferation of open source, understanding these issues is increasingly the responsibility of the individual programmer. Advanced C and C++ Compiling brings all of the information needed to move from intermediate to expert programmer together in one place -- an engineering guide on the topic of C/C++ binaries to help you get the most accurate and pertinent information in the quickest possible time.
What you'll learn
- The details of the build process, including compiling and linking
- The inner workings of static libraries, shared libraries, and executables
- Ways to properly architect code for smooth integration of future changes
- Tips for troubleshooting problems with compiling and linking as well as run-time problems
- How to use operating system-specific (Linux and Windows) tools for analysis of binary files
Table of Contents
- Multitasking OS Basics
- Simple Program Lifetime Stages
- Program Execution Stages
- The Impact of Reusing Concept
- Working with Static Libraries
- Designing Dynamic Libraries: Basics
- Locating the Libraries
- Designing Dynamic Libraries: Advanced Topics
- Handling Duplicate Symbols When Linking In Dynamic Libraries
- Dynamic Libraries Versioning
- Dynamic Libraries Miscellaneous Topics
- The Linux Toolbox
- Linux HowTo's
- Windows Toolbox
Why Read This Book
You will learn how compilers, assemblers, linkers, and loaders transform your C and C++ source into real binaries so you can diagnose, fix, and optimize build-time and runtime problems. The book gives practical, tool-centric explanations (objdump, readelf, ld scripts, cross-toolchains) that help you confidently integrate third-party libraries and build reliable firmware and embedded Linux images.
Who Will Benefit
Intermediate-to-advanced C/C++ developers, firmware engineers, and system integrators working on embedded systems or Linux who need to understand object formats, linking, ABI issues, and cross-compilation to ship reliable binaries.
Level: Advanced — Prerequisites: Solid C and/or C++ programming experience, familiarity with the command line and basic compilation (gcc/clang, compiling and linking), and exposure to Make or another build system.
Key Takeaways
- Analyze object file formats (ELF, COFF) and interpret symbol tables, relocations, and sections to troubleshoot binary issues
- Create, manage, and deploy static and shared libraries and control symbol visibility and versioning
- Diagnose and resolve linking and ABI mismatches between different compilers, runtimes, or third‑party libraries
- Cross‑compile and configure toolchains and linker scripts for embedded targets (ARM, MIPS, etc.) and reduce runtime surprises
- Apply build-system and compiler/linker options to optimize binary size, startup time, and performance
- Use binary inspection and debugging tools (objdump, readelf, nm, ldd, gdb) to validate and harden delivered binaries
Topics Covered
- Introduction: Why binaries matter
- Compilation pipeline: Preprocessing, compiling, assembling, linking
- Object file anatomy: Sections, symbols, relocations
- Static libraries and archives (ar), symbol resolution
- Shared libraries, dynamic linking, and runtime loaders
- Name mangling and C++ linking model
- ABI and calling conventions across architectures
- Linker scripts, symbol versioning, and visibility control
- Cross-compilation and embedded toolchain integration
- Compiler and linker options for size and performance
- Debugging and inspection tools: objdump, readelf, nm, strip, ldd, gdb
- Build systems and reproducible builds (Make, Autotools, CMake)
- Common integration problems and real-world case studies
- Appendices: Binary formats, reference commands, and further reading
Languages, Platforms & Tools
How It Compares
Covers much the same practical ground as John R. Levine's Linkers and Loaders but is more focused on modern C/C++ toolchains, cross‑compilation, and hands‑on tooling for embedded and Linux developers.













