Cross-Platform Software: Portability as a Software Feature

Lecture 6 min.



Cross-platform (multi-platform) is the ability of software to work with several hardware platforms or operating systems. It is achieved through the use of high-level programming languages and development and runtime environments that support conditional compilation, linking and execution of code for different platforms. A typical example is software designed to run on the Linux and Windows operating systems at the same time.

Cross-platform compatibility, also known as multi-platform compatibility, is a property of software that allows it to run on several platforms or operating systems without significant changes. It is an important characteristic for application development, as it provides broader user reach and saves development resources. Here are several key aspects of cross-platform compatibility:

  1. Programming language: Using programming languages that support cross-platform development. Some popular cross-platform languages include Java, JavaScript (using frameworks such as React Native or Flutter), C# (using Xamarin) and Python.

  2. Frameworks and libraries: Using cross-platform frameworks and libraries that provide abstractions over platform-specific characteristics. For example, Xamarin, Flutter, React Native, Electron and Qt.

  3. User interface: Developing user interfaces that adapt to the standards of each platform. Some frameworks allow shared code for business logic and have the ability to create native user interfaces.

  4. Testing: Comprehensive testing on various platforms to ensure compatibility and stable operation of the application.

Examples of cross-platform applications include Microsoft Office, Slack, Skype, and many mobile applications built with the React Native and Flutter frameworks. Cross-platform compatibility is a key element in improving development efficiency and provides broader access to applications for users of different platforms.

Cross-Platform Software: Portability as a Software Feature

Swing looks the same on all operating systems.

Cross-Platform Software: Portability as a Software Feature

Mozilla Firefox, which uses XUL, styles its windows to match the OS (in this case, Linux).

Cross-platform programming languages

Most modern high-level programming languages can be called cross-platform. For example, C, C++, Free Pascal, FreeBASIC and PureBasic are cross-platform languages at the compilation level, meaning compilers exist for these languages for various platforms. This makes it possible, given proper code quality, not to rewrite the program's core engine; only the special system-dependent parts change.

Standardized runtime libraries are no less important for cross-platform compatibility. In particular, the C language library (POSIX) has become a standard. Large cross-platform libraries include Qt, GTK+, FLTK, STL, Boost, OpenGL, SDL, OpenAL and OpenCL.

There are cross-compilers: compilers that generate executable code for a platform different from the one on which the compiler itself runs.

Cross-platform runtime environments

PHP, Perl, Python, Tcl and Ruby are cross-platform interpreted languages; their interpreters exist for many platforms.

The ActionScript Virtual Machine, Java Virtual Machine and .NET runtime environments are also cross-platform, but their input is not source text but intermediate code. Therefore, programs written in ActionScript, Java and C# can be run under different operating systems without prior recompilation.

Cross-platform user interface

On different operating systems and environments, regardless of how running on them is technically achieved, standard interface elements have different sizes. Therefore, simple fixed positioning of interface elements is impossible: in another operating system (environment) they may overlap one another, "blur" or "get drunk". There are several approaches:

  1. A single style common to all operating systems, so programs look the same under all systems. This is how Java interface libraries such as Swing work.
    • Pro: controls can be positioned rigidly in the manner of Delphi, and the style is original.
    • Con: the system has to have its own screen fonts, and the style differs from the OS style.
  2. A self-adapting (adaptive) interface that adjusts the grid to the actual sizes of the controls. Typical examples are Qt, wxWidgets and XUL.
    • Pro: the standard style of the operating system, very fast and "skinnable" under Windows XP, Vista and Windows 7, and some automation of localization.
    • Con: assembling a self-adapting (adaptive) grid requires a skilled programmer, and dense layout is difficult.
  3. A hybrid approach is implemented in GTK+.
    • Pro: fonts can be taken from the system rather than "dragging along" your own, and there is some automation of localization.
    • Con: it inherits all the drawbacks of the first two approaches. The style differs from the operating system's style, and dense layout is difficult.

In any case, at least minimal testing is required in other operating systems and environments, since layout errors are possible.

Conditional compilation

Even despite the generally broad standardization of hardware and software, a programmer often has to set up branches for different operating systems and environments, enabling one or another through conditional compilation.

For example, the Mozilla Firefox browser has different sets of icons for different operating systems.

Application programs

A large number of application programs are also cross-platform. This quality is especially pronounced in programs originally developed for Unix-like operating systems. An important condition for porting them to other platforms is the platform's compatibility with POSIX recommendations, as well as the existence of a GCC compiler for the platform being ported to.

Operating systems

Modern operating systems are also often cross-platform. For example, open-source operating systems (in particular NetBSD, Linux, FreeBSD and AROS) can run on several different hardware platforms. The most common are x86, m68k, PowerPC, Alpha, AMD64 and SPARC. ("Elbrus OS" is nothing other than a deeply modified system for the "Elbrus" platform. But "Elbrus OS" is also available for the "Elbrus-SPARC" platform, which is an implementation of the SPARC platform by MCST, and for the x86 platform.) The first release of Microsoft Windows NT 4, released in 1996, supported four platforms (x86, Alpha, MIPS and PowerPC); in later versions of Windows NT only x86 support remained. Modern Microsoft Windows can run on both the Intel x86 and the Intel Itanium platforms. (More precisely, for Itanium there are only Windows 2000/XP, Windows 2003 and Windows 2008 versions, after which Itanium support was wound down.) The NetBSD operating system is considered the most multi-platform ; it has been ported to most currently existing platforms.

Development environments

A number of IDEs, including Free Pascal, Lazarus and Qt Creator, work on different operating systems: Linux, Windows and others .

Emulation

If a program is not intended to be run on a particular platform, but an emulator exists for that platform of the program's base platform, then the program can be run in the emulator's environment.

Running a program in an emulator usually results in reduced performance compared with similar programs for which the platform is native, since a significant part of the system's resources is spent on performing the emulator's functions.

created: 2024-02-04
updated: 2026-09-29
115



Was this answer useful?
Choose a quick rating so we can improve the next answer for you.
How satisfied are you?


Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Cross platform programming"

Terms: Cross platform programming