Skip to content
0:00 / 0:00

#linker#compiler#cppcon

Back to Basics: Compiling and Linking - Ben Saks - CppCon 2021

CppCon

189K subscribers • 136 videos on Hallway • Conference channel

YouTube
  • Recommended by 1 person: 1 in engineering communities.
  • Presented by Ben Saks
  • Linked in the descriptionCppCon/CppCon2021

Intermediate. Assumes working knowledge.

64K views4 years ago1 recommendation

Systems programmingProgramming languagesCompilers and interpretersC++C

Ben Saks explains the traditional C and C++ build model, detailing what happens during preprocessing, compilation, template instantiation, and linking.

cppcon.org/ github.com/CppCon/CppCon2021 --- Most C and C++ programmers know the conventions for distributing declarations and definitions among headers and source files. However, there are exceptions to these conventions that we often chalk up to “linker magic”. If the linker can’t deal with multiply-defined symbols, how does it handle inline and constexpr functions? Why do explicit template specializations go into source files when most template code goes into headers? And what can embedded developers do to tell the linker to map certain code and data into specific memory regions? This session answers these questions by taking a detailed look at how the traditional C/C++ build model works with headers and source files. It describes what happens during each stage of the build process: preprocessing, compiling, instantiation, and linking. It explains what information the compiler records from declarations and definitions – including exceptional cases like inline and templates – and how the linker uses that information to generate an executable. It also shows how you can use explicit instantiation to control memory layout and reduce build times. Finally, this session walks an example program through the entire build process to demonstrate how everything fits together. This is **not** a session on C++20 Modules. However, it explains terms such as “translation unit” and “linkage” that are also part of the Modules framework, providing a solid foundation for understanding Modules. --- Ben Saks --- Videos Streamed & Edited by Digital Medium: online.digital-medium.co.uk Register Now For CppCon 2022: cppcon.org/registration/

Why it's here

1 person recommends this

What people say. Recommended as an essential talk for understanding the C and C++ compilation and linking process.

u/eis3nheimin r/embedded • Recommends

On “Dev environment”

If you want to understand the building process then I found the series From Zero-to-main of articles by the Interrupt to be helpful. Also the talk Back to Basics: Compiling and Linking by Ben Saks. Worth your time.