Results 1 to 4 of 4
I often hear of developers saying that their application can run on "Windows, OSX, and Linux". Obviously you all know that their are many distributions of Linux. How can it ...
- 05-27-2010 #1Just Joined!
- Join Date
- May 2010
- Posts
- 1
semi-standard API?
I often hear of developers saying that their application can run on "Windows, OSX, and Linux". Obviously you all know that their are many distributions of Linux. How can it be possible that an application can run on "Linux" in general? I know there's no standard API for every distribution, but is there at least some API that major distros can agree on being the standard?
- 05-28-2010 #2Linux Newbie
- Join Date
- Apr 2007
- Posts
- 119
By saying that it can run on Linux, there are basic kernel/library requirements that must be met. 99% of all distros are shipped with a base set of libraries. By having these libraries, your application can run on any distro.
- 05-28-2010 #3Linux User
- Join Date
- Jan 2006
- Posts
- 414
There is a standard API, in fact depending on what the application is/does, there's many of them.
A hardware driver is simply a kernel module, so it uses the kernel's API.
A command line program uses the standard C (or whatever language it's written in) API.
A graphical program will use the Xlib API.
A desktop program will use the GTK or Qt API.
A 3D game will use the OpenGL API.
These are all standard API's, most of which extend beyond Linux and into several other OS's as well.
- 05-28-2010 #4
Every* distribution of Linux, is, behind the scenes, the same. Distributions tend to differ only in installation procedure, default packages, and the method of installing new packages.
Are you familiar with the term "GNU/Linux"? Those who use the term do so because they argue that Linux is only one component of the operating system, namely the kernel. The rest of the operating system is provided by GNU (standing for GNU's Not UNIX), which is a suite of libraries and software that provide alternatives to the old, closed-source UNIX model.
Among GNU software is the coreutils packages, which provides commands like "ls", "chmod", "rm", etc. GNU also provides a package called glibc, stasnding for GNU C Library. This is the standard C Library, adhering to C standard (so your stdio.h, etc.), the POSIX standard (the basis for UNIX-like operating systems), as well as GNU extensions (for instance, the asprintf() function).
Every* Linux distribution uses GNU software, so every* Linux system uses glibc, which allows software written for glibc to run on any Linux system.
Writing software cross-platform (Linux, Mac OS X, Windows) is a bit more complicated, but for instance, Mac OS X is based on BSD, which is also a UNIX-like system and which adheres to the POSIX standard, so any POSIX-compliant program can run on both Linux and Mac OS X. Windows is a whole different goose, but by the use of conditional compilation and wrapper libraries, you can write a program that behind the scenes uses different function calls if it's on Linux or Windows.
But writing a program to run on all Linuxes is very easy. The user may have to install additional packages to satisfy dependencies, but it will all work easily.
* for most values of "every"DISTRO=Arch
Registered Linux User #388732


Reply With Quote
