Write once, compile anywhere (WOCA) is a philosophy taken by a software platform which refers to a capability of writing a computer program that can be compiled on all platforms without the need to modify its source code. As opposed to Sun's write once, run anywhere slogan, cross-platform compatibility is implemented only at the source code level, rather than also at the compiled binary code level.
There are many languages that follow the WOCA philosophy, such as C++, Pascal (see Free Pascal), Ada or C, on condition that they don't use functions beyond those provided by the standard library. A computer program may also use a cross-platform libraries, which provide an abstraction layer hiding the differences between various platforms, for things like sockets and GUI, ensuring the portability of the written source code.
See also