What’s an obj file?

Print anything with Printful



Object files are generated by compilers and contain data and instructions. They are joined by a linker to form an executable program. Object files have different formats and contain three types of information for interaction with other program modules. Libraries are collections of precompiled routines stored as object code. Object files can be used by multiple running programs through dynamic linking.

An object file is a computer file generated by a program called a compiler and contains data and instructions. Compilers translate the source code of the programming language into an intermediate machine-readable form known as object code. Smaller programs might be compiled into a single object file, while larger programs are usually compiled into multiple files of related functions. These individual object files are joined by a linker, and operating system-specific information is added to form an executable program.

In common practice, an object file is denoted by an “.obj” file extension. However, there are different formats for these files. The most common are the Intel® Relocatable Object Module Format (OMF) and the Common Object File Format (COFF) of Windows® and UNIX® System V. In many INIX® systems, the Executable and Linkable Format (ELF) has come to replace COFF.

Regardless of format, an object file typically contains three types of information that allow it to interact with other program modules. Procedures and data that are open to external references are given names by which they can be called from other modules. Similarly, references to information outside the form are noted but not assigned a name. When files are linked, unnamed references will be given the name given to them in the form in which they were originally defined. Local names are used for statements and data that are referenced only within a module.

Not all pluggable code is stored as object files. Libraries are collections of precompiled routines stored as object code. They are produced in much the same way as object files and are useful for storing frequently called procedures. When a linker doesn’t find a reference within other object files, it will automatically look for it in a library file. Most implementations of a programming language come with a standard library of functions.

Through dynamic linking, an object file can be used by multiple running programs at the same time. Instead of associating object code with a program when linked, it is fetched when the program is loaded or at runtime when a procedure is referenced. In the Windows® environment, these are known as dynamic link libraries and are indicated by a “.dll” extension. Unix®-like systems often refer to this type of file as a dynamic shared object (DSO). This type of object file may also be implemented for use with a particular program and would be part of that program’s installation.




Protect your devices with Threat Protection by NordVPN


Skip to content