In computer science, porting is the adaptation of a piece of software so that it will function in a different computing environment to that for which it was originally written.
Porting is usually required because of differences in the central processing unit, operating system interfaces, different hardware, or because of subtle incompatibilities in—or even complete absence of—the programming language used on the target environment.
Portability is a property of software that is easy to port. As operating systems, languages, and programming techniques evolve, software becomes increasingly simple to port between environments. One of the original objectives of the C programming language and the standard C library, for instance, was to ease porting of software by providing a common API to different and otherwise incompatible computing hardware.
Generally, using higher-level function calls instead of bare OS-level APIs improves portability.
International standards, such as those promulgated by ISO, greatly facilitate porting because they specify the details of the computing environment in a way that vary very little among platforms. Often, porting software between two platforms that implement the same standard (such as, for instance, POSIX.1), is simply a matter of recompiling the program on the new platform.
There also exists an increasing number of tools to facilitate porting, such as GCC which provides consistent programing languages on different platforms, and autoconf which automates the detection of minor variations in the environment and adapts the software accordingly before compilation.
Two activities related to, but distinct from, porting are emulating and cross-compiling.
Porting is also the term used when a computer game designed to run on one platform, be it a personal computer or video game console, is converted to run on another platform. Earlier video game ports were not true ports but rather complete rewrites, but more and more video games are developed using editing software which can output code for PCs as well as one or more consoles. Many early ports suffered from bad quality because the hardware of PCs and consoles differed greatly.
Ways of improving portability