Cross-Platform Abstraction Libraries for Portable Development

Introduction

Programming an application that can run both on Unix-like systems and on Microsoft Windows (and optionally other platforms) can be very hard because of the fact that the APIs of those platforms are substantially different. Luckily, there are abstraction libraries with which a programmer can maintain a very similar code, while focusing on writing the application itself.

I will focus here on such libraries for C and C++. Higher level languages such as Perl, Python or Ruby usually provide abstractions for such things within the language or bindings to libraries in lower-level languages.

Data Structures

  • GLib - a C library that provides many useful classes. It is comprehensive, but sometimes common useful programming practices (such as supplying a callback context argument) are ignored. It also tends to have non-optimised code. LGPLed.

  • Kazlib - Provides a Red-Black tree, a hash table, and a linked list manager. An Open-Source License.

  • The C++ Standard Template Library (STL) - Provides abstractions for many common data structures.

  • The libavl Homepage - Contains links to many implementations of balanced binary trees.

  • countertree - a balanced binary tree that also provides array/vector-like functionality. (C++ / open source: Boost Software License.)

  • C2Lib - Library of Basics for C that contains a pool allocator, a Perl-like vector, hashes, Perl-like strings, and matrix and vector functions. LGPLed.

  • QtCore - a part of Qt that provides data structures and system services (and not GUI). LGPLed starting from version 4.5. Previously licensed under either the GPL or a commercial licence. Qt’s Logo

System-Services Abstractions

  • GLib

  • The Apache Portable Run-Time (APR) - contains portable abstractions for many purposes, from memory allocation to threads. Open-source, Apache Group License.

  • ACE - The Adaptive Communication Environment - a comprehensive C++ library that provides portable abstractions for almost anything a system gives you except GUI. Runs on UNIX, Win32 and many embedded operating-systems.

  • ZThreads - a C++ library that abstracts UNIX and Win32 threads. LGPL.

  • POSIX Threads for Win32 - an implementation of the POSIX threads (pthreads) API for Win32. LGPL.

  • RogueWave’s SourcePro Core - a commercial library that supplies C++ abstractions for many system services.

  • wxBase - a subset of the wxWidgets library that can be used for multi-threading and the such. C++ and LGPLed.

  • The Netscape Portable Runtime (NSPR) - a C library that abstracts Threads, sockets, files, data structures and many other goodies. Open source under the MPL licence.

  • Boost - a free portable collection of C++ libraries that work well with the C++ Standard Library. Contains abstractions for data-structures and algorithms, parsing and I/O and sockets.

  • plibsys - an open source (LGPLed) and cross-platform C library for encapsulating system services such as threads and some data structures.

  • Dlib - a C++ library that provides many APIs, including threading, networking, GUIs, numerical algorithms, machine learning algorithms, image processing, and more. (Open source under the Boost licence.)

  • C++ Portable Components - cover functionality like threads, thread synchronisation, filesystem access, streams, shared libraries and class loading, sockets and network protocols (HTTP, FTP, SMTP, etc.), including an HTTP server, as well as an XML parser with SAX2 and DOM interfaces.

  • Intel Threading Building Blocks - a library for threading abstractions (open source).

  • QtCore - a part of Qt that provides data structures and system services (and not GUI). LGPLed starting from version 4.5. Previously licensed under either the GPL or a commercial licence.

Graphical User-Interface (GUI)

  • wxWidgets (formerly wxWindows) - a C++ cross-platform GUI library with Win32 , X-Windows and Mac OS X back-ends. Native look-and-feel. LGPLed.

  • Qt - a C++ cross-platform GUI library with Win32, X-Windows and Mac OS X backends. A very encompassing API. LGPLed starting from version 4.5. Previously licensed under either the GPL or a commercial licence. Qt’s Logo

  • GTK+ - a multi-platform GUI toolkit for C, with bindings to many other languages. LGPLed. May look ugly with the default theme, but other themes are available.

  • Mozilla’s XUL - a C++ cross-platform GUI library for X-Windows, Win32 and Mac OS based on XML. (Open source, MPL.)

  • FLTK - short for “Fast Light Toolkit”, FLTK is a lightweight cross-platform GUI toolkit. LGPLed.

  • ParaGUI - a GUI library based on the SDL framework. LGPLed.

  • Borland’s VCL - The GUI library behind Delphi and C++ Builder. Proprietary License, which is free for use for developing Open-Source Programs. Note: the Linux version is no longer up-to-date or supported.

  • The FOX Toolkit - a C++ toolkit that runs on UNIX, Windows and Mac OS X. Renders its own controls, so does not have the system-wide native look and feel, but, on the other hand, has a consistent one across all platforms.

  • Winelib - an open source (LGPLed) compatibility layer of the Windows API for UNIX-like and other systems.

  • The “TurboC” Library - an open source (LGPLed) library for providing the functionality of some of the headers of Borland Turbo C for DOS, on Unix-like systems such as Linux.

  • A comprehensive list of GUI libraries for X-Windows (and perhaps other systems)

Multimedia

  • SDL - The Simple DirectMedia Layer - a comprehensive library that runs on Win32, BeOS and Mac OS and several flavours of UNIX. Has bindings to many other languages

  • OpenGL - a portable library for 3-D and 2-D graphics, that provides many graphics primitives. Has an open-source LGPLed implementation titled Mesa.

  • SFML - “Simple and Fast Multimedia Library” - an open source (zlib licence) library for multimedia and games. C++ with C bindings.

  • Crystal Space - a portable library for managing a large number of objects in a three-dimensional world.

  • Open Inventor - A library for managing objects and manipulators in 3-D Space. LGPL. Runs on Windows, Linux and IRIX.

  • OpenAL - a library for generating three-dimensional sound. LGPLed.

  • PLib - a suite of portable game libraries. LGPLed.

  • ClanLib - a portable C++ game SDK. LGPLed.

  • Godot Engine - an open source game engine.

  • Unreal Engine - a proprietary 3-D engine for games.

Database Access

Consoles / Terminals

  • PDCurses - a public domain curses library for DOS, OS/2, Windows console, X11 and SDL, implementing most of the functions available in X/Open and System V R4 curses.

  • ncurses

  • libtickit - This library provides an abstracted mechanism for building interactive full-screen terminal programs. It provides a full set of output drawing functions, and handles keyboard and mouse input events.

  • conio for Linux - GPL.

  • Master database of terminal descriptions - on Eric Raymond's site.

Credits

  • Qt’s logo taken from the English Wikipedia under the public domain.

Licence

Creative Commons License

This document is Copyright by Shlomi Fish, 2011, and is available under the terms of the Creative Commons Attribution License (CC-by) 3.0 Unported (or at your option any later version of that licence).

For securing additional rights, please contact Shlomi Fish and see the explicit requirements that are being spelt from abiding by that licence.