Compilation Unit

Definition - What does Compilation Unit mean?

A compilation unit refers to a C source code which is compiled and treated as a single logical unit. It is generally one or more complete files; however, it also may be a certain part of a file if the #ifdef preprocessor directive is applied to choose specific code sections.

Definitions and declarations within the compilation unit establish the scope of data objects.

Techopedia explains Compilation Unit

The compilation unit incorporates the files included using the #include preprocessor directive as part of it. However, it does not incorporate the source lines that are skipped due to the conditional inclusion preprocessor directives.

Compilation units are crucial to identify the scope of identifiers, and to determine the linkage of identifiers with other external and internal identifiers.

A compilation unit may relate to functions or data in other compilation units in the below given means:
  • A function in one compilation unit could very well call a function in a completely different compilation unit.
  • External linkage can be assigned to data objects to ensure that other compilation units can access them.
Programs comprised of more than a single compilation unit could be compiled individually, and then later linked to create the executable program. A legitimate C compilation unit includes no less than one external declaration.

This definition was written in the context of Programming
Share this:

Connect with us

Email Newsletter

Join thousands of others with our weekly newsletter

The 4th Era of IT Infrastructure: Superconverged Systems
The 4th Era of IT Infrastructure: Superconverged Systems:
Learn the benefits and limitations of the 3 generations of IT infrastructure – siloed, converged and hyperconverged – and discover how the 4th...
Approaches and Benefits of Network Virtualization
Approaches and Benefits of Network Virtualization:
Businesses today aspire to achieve a software-defined datacenter (SDDC) to enhance business agility and reduce operational complexity. However, the...
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.