Cross-Platform Support Middleware
Encyclopedia
A cross-platform support middleware (CPSM) is a software abstraction layer
Abstraction layer
An abstraction layer is a way of hiding the implementation details of a particular set of functionality...

 that guarantees the existence, and correct implementation, of a set of services on top a set of platforms
Platform (computing)
A computing platform includes some sort of hardware architecture and a software framework , where the combination allows software, particularly application software, to run...

.

Formal model

Formally, a CPSM can be represented by the following model:
  • Let be the set of provided services, and the elements of that set, with .
  • Let be the set of supported platforms, and the elements of that set, with .
  • The special service denotes the set of trivially cross-platform services provided (e.g. programming language, buffered I/O, etc.).
  • Thus, a CPSM can be defined as:
    Where the strong condition for the existence of is that every service in is available in every platform in .


The formal model may be extended to account for the abstract and concrete (native) interfaces of the services provided:
  • Let be the concrete (native) interface for service in platform .
  • Let be the set concrete (native) interfaces (i.e. ).
  • Let be the abstract interface for service , provided by the CPSM regardless of the underlying platform.
  • Let be the set abstract interfaces (i.e. ).


Formally, the strong condition for the existence of a CPSM can be expressed as:

Trivial CPSM

There are two trivial cases of a CPSM: the single-platform CPSM and the inherently compatible CPSM.

A single-platform CPSM is compatible with one, and only one platform. Formally, , or, equivalently, . In broad terms, an operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

 might be considered a single-platform CPSM.

An inherently compatible CPSM is an abstraction layer that only provides services trivially compatible in every compatible platform. Formally, , or, equivalently, .

Non-trivial CPSM

A non-trivial CPSM must verify two conditions:
  • The compatible platform set must contain at least two platforms.
  • The provided services set must contain at least one non-trivial service.


Formally:

Abstraction method

The abstraction method in the CPSM development is the method used to compile the concrete source code for a given platform without compromising the abstract interfaces provided.
The most commonly used abstraction methods in CPSM development are: conditional compilation
Conditional compilation
In computer programming, conditional compilation is compilation implementing methods which allow the compiler to produce differences in the executable produced controlled by parameters that are provided during compilation...

 and directory separation of sources.

The first method consists in embedding preprocessor instructions in the source code to conditionally select the source subtree compatible with a given platform.

The second method takes advantage of the filesystem organization to divide the source code in different folders, one for each incompatible platform. Thus delegating the selection problem to the build system.

Some distributions like MSYS and cygwin
Cygwin
Cygwin is a Unix-like environment and command-line interface for Microsoft Windows. Cygwin provides native integration of Windows-based applications, data, and other system resources with applications, software tools, and data of the Unix-like environment...

 may help build the cross-platform code in a unix-like environment even on Microsoft Windows. Both distributions provide a decent version of GNU Make that can direct the build process in a cross-platform fashion.

See also

  • Adaptive Communication Environment
    Adaptive Communication Environment
    The Adaptive Communication Environment is an open-source framework used to simplify various aspects of network programming...

  • Netscape portable runtime
    Netscape Portable Runtime
    In computing, the Netscape portable runtime, or NSPR, a platform abstraction library, makes all operating systems it supports appear the same to Mozilla-style web-browsers. NSPR provides platform independence for non-GUI operating system facilities...

  • Simple DirectMedia layer
    Simple DirectMedia Layer
    Simple DirectMedia Layer is a cross-platform, free and open source multimedia library written in C that presents a simple interface to various platforms' graphics, sound, and input devices....

  • wxWidgets
    WxWidgets
    wxWidgets is a widget toolkit for creating graphical user interfaces for cross-platform applications. wxWidgets enables a program's GUI code to compile and run on several computer platforms with minimal or no code changes...

  • Boost C++ libraries
  • GTK+
    GTK+
    GTK+ is a cross-platform widget toolkit for creating graphical user interfaces. It is licensed under the terms of the GNU LGPL, allowing both free and proprietary software to use it. It is one of the most popular toolkits for the X Window System, along with Qt.The name GTK+ originates from GTK;...

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK