What is Object Code in a Computer Program

A Program in computer consists of two; first is the source code, other is the object code. Source code is the version of a computer program as it is originally written i.e. typed into a computer by a programmer in a programming language. A compiler is a specialized program that converts source code into object code and it converts the whole program at a time. The object code is a machine code, also called a machine language, which can be understood directly by a specific type of CPU (central processing unit).

So the Object code is the code which is executed by the compiler and is then sent for execution. Some compilers are designed to convert source code into an assembly language (human readable notation for the machine language that a specific type of CPU uses) or some other another programming language. This conversion is done because computers can only execute programs written in low level languages. Thus, programs written in a high level language have to be processed before they can run.

The extra pro processing takes some time which is adds as a disadvantage of high level languages. But there are a number of advantages; as it is much easier to program in a high level language. Programs written in a high level language take less time to write, they are shorter and easier to read, and they are more likely to be correct. High level languages are portable while Low level programs can run on only one kind of computer and have to be rewritten to run on another.

A machine code file can be immediately executable i.e. runnable as a programmer it might require linking with other object code files e.g. libraries to produce a complete executable program. An object code file can contain not only the object code, but also relocation information that the linker uses to assemble multiple object files to form an executable program. It can also contain other information, such as program symbols and debugging information.

Thus object code is simply the machine language output of a compiler that is ready for execution on a particular computer and an object file format is a format that is used for the storage of object code and related data produced by a compiler.

Related Posts
No related posts for this content