|This article needs additional citations for verification. (July 2008)|
In computing, an executable file causes a computer "to perform indicated tasks according to encoded instructions," as opposed to a data file that must be parsed by a program to be meaningful. These instructions are traditionally machine code instructions for a physical CPU. However, in a more general sense, a file containing instructions (such as bytecode) for a software interpreter may also be considered executable; even a scripting language source file may therefore be considered executable in this sense. The exact interpretation depends upon the use; while the term often refers only to machine code files, in the context of protection against computer viruses all files which cause potentially hazardous instruction execution, including scripts, are lumped together for convenience.
Generation of executable files
While an executable file can be hand-coded in machine language, it is far more usual to develop software as source code in a high-level language easily understood by humans, or in some cases an assembly language more complex for humans but more closely associated with machine code instructions. The high-level language is compiled into either an executable machine code file or a non-executable machine-code object file of some sort; the equivalent process on assembly language source code is called assembly. Several object files are linked to create the executable.
The same source code can be compiled to run under different operating systems, usually with minor operating-system-dependent features inserted in the source code to modify compilation according to the target. Conversion of existing source code for a different platform is called porting.
Interaction with computing platforms
An executable comprises machine code for a particular processor or family of processors. Machine-code instructions for different processors are completely different and executables are totally incompatible.
Some dependence on the particular hardware, such as a particular graphics card may be coded into the executable. It is usual as far as possible to remove such dependencies from executable programs designed to run on a variety of different hardware, instead installing hardware-dependent device drivers on the computer, which the program interacts with in a standardised way.
Some operating systems designate executable files by filename extension (such as .exe) or noted alongside the file in its metadata (such as by marking an "execute" permission in Unix-like operating systems). Most also check that the file has a valid executable file format to safeguard against random bit sequences inadvertently being run as instructions. Modern operating systems retain control over the computer's resources, requiring that individual programs make system calls to access privileged resources. Since each operating system family features its own system call architecture, executable files are generally tied to specific operating systems, or families of operating systems.
There are many tools available that make executable files made for one operating system work on another one by implementing a similar or compatible application binary interface. (For example Wine, which implements a Win32-compatible library for x86 processors)
When the binary interface of the hardware, the executable was compiled for, differs from the binary interface on which the executable is run, the program that does this translation is called an emulator. Different files that can execute but do not necessarily conform to a specific hardware binary interface, or instruction set, can be either represented in bytecode for just-in-time compilation, or in source code for use in a scripting language. (see Shebang (Unix))