Basics of Cross Platform Programming

Lecture



CAT Basics

Cross-platform (cross-platform) software - software that runs on more than one hardware platform and / or operating system. A typical example is software designed to work on Linux and Windows operating systems at the same time.

Cross Platform Programming Languages

Most modern high-level programming languages ​​can be called cross-platform. For example, C, C ++, Free Pascal are cross-platform languages ​​at the compilation level, that is, for these languages ​​there are compilers for various platforms. This allows - with proper code quality - not to rewrite the main engine of the program, only special system-dependent parts are changed.

Equally important for cross-platform standardized runtime libraries. In particular, the C library has become the standard (see POSIX). From large cross-platform libraries - Qt, GTK +, FLTK, STL, Boost, OpenGL, SDL, OpenAL, OpenCL.

Cross Platform Runtime Environments

Even at the dawn of the PC, IBM made its personal computer compatible with CP / M. This allowed to run on it already existing programs.

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

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

Cross-platform user interface

On different operating systems - regardless of how technically achieved work in them - the standard interface elements have different sizes. Therefore, a simple rigid positioning of the interface elements is impossible - under a different OS, they can fit on each other. There are several approaches.

  1. Uniform style common to all OS. Programs look the same under all OS. This is how Java interface libraries work like Swing.
  • Plus: you can rigidly arrange the controls in the manner of Delphi; original style.
  • Minus: the system has to have its own screen fonts; style is different from OS style.
  1. A self-adapting interface that adjusts the grid to the actual dimensions of the controls. Typical examples are wxWidgets, XUL.
  • Plus: the standard OS style, very fast and “skins off” under Windows XP, Vista and 7; some localization automation.
  • Minus: to assemble a self-adaptive mesh, requires a qualified programmer; difficult tight layout.
  1. Hybrid approach implemented in GTK +.
  • Plus: fonts can be taken from the system, and not “drag” your own; some localization automation.
  • Minus: takes all the flaws from the first two approaches. The style is different from the OS style; difficult tight layout.

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

created: 2016-01-17
updated: 2021-03-30
132418



Rating 7 of 10. count vote: 4
Are you satisfied?:



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

Cross platform programming

Terms: Cross platform programming