Navigation

OS Abstraction/Portability Libraries List

(Looking for a freelance software developer? You found one. Visit the home page.)

A list and brief description of every OS-abstraction library I've found for C++.

As one who writes code for both Win32 and various Unixish systems, I've found myself writing an OS-abstraction layer to take care of OS-dependent details.

I also come across libraries already written. Here's a list, in no particular order. I'll add some notes as I find time, but don't intend to extensively evaluate/compare them. When you see quotes, they're the authors' words.

Licenses are generally permissible (LGPL, Apache, MIT, etc.), but do review them before investing too much.

Apache Portable Runtime (APR)-- The C library upon which Apache is built. Abstracts the file system as well as threads (think: everything apache needs to operate). Warning: the documentation (straight doxygen) is not for the feint of heart. Also has:

APR-util: a companion library, with an MD5 algorithm, Base64 encoding, database abstraction and more

APR-iconv: a portable implementation of the iconv() library (notoriously different between Linux and FreeBSD, and missing on Win32).

Qt, "a cross-platform application and UI framework," is a feature-rich and very mature set of libraries originally developed by TrollTech. The core module has the OS abstraction. Though the previous license was very restrictive, Nokia acquired it and released it LGPL. Digia currently manages it, including a commercial edition.

Omnithreads, part of the OmniORB CORBA ORB, is an excellent object-oriented abstraction of threads and thread-safety mechanisms. The documentation is pretty good, as I recall. It doesn't abstract sockets, though.

boost now has threading (Interprocess and Thread), as well as portable networking (Asio) and file system abstractions (Filesystem). Interprocess and Asio are as of release 1.35 (March 29, 2008). Boost can be a little heady or pedantic**, but it represents a lot of excellent work. Check their test results against your platform before investing too heavily.

GLib "provides the core application building blocks for libraries and applications written in C. It provides the core object system used in GNOME, the main loop implementation, and a large set of utility functions for strings and common data structures." Seems to be LGPL. (Reference here. Sources here. Win32 port info here.) Note that it's C, not C++. Wikipedia calls it cross platform, provides a long list of features, and says "For many applications, C with Glib is an alternative to C++ with STL." (My bias is towards C++/STL.) The lighttpd project is sold on it.

Mark Lindner's commonc++ "provides an intuitive, object-oriented abstraction/portability layer around common operating system facilities like threads, concurrency mechanisms, sockets, networking, shared memory and other IPC mechanisms, regular expressions, files, streams, logging, process execution, scheduling, and more. It also includes a collection of common abstractions like strings, buffers, object pools, a random number generator, timers, and so on."

Ultimate++ "is a C++ cross-platform rapid application development suite focused on programmers productivity. It includes a set of libraries (GUI, SQL, etc..), and an integrated development environment."

GNU Autoconf, Automake, Libtool, etc., otherwise known as the Autotoolset, is the granddaddy of portability tools. A good way to make code as portable as possible, but very intimidating and fills the code with conditional compiles. Start with this tutorial. (Wikipedia has a good overview, too.) For Win32, you'll need MinGW/MSYS (Minimalist GNU/SYStem for Windows). If you need to port to every obscure Unix flavor and OS, you'll probably wind up here. The tools are GPL, but they don't bundle with your application.

NCBI C++ Toolkit, from the National Institutes of Health's National Center for Biotechnology Information. "NCBI C++ Toolkit provides free, portable, public domain libraries with no restrictions use - on Unix, MS Windows, and Mac OS platforms..." Toolkits spanning the spectrum.

SCons: "Think of SCons as an improved, cross-platform substitute for the classic Make utility with integrated functionality similar to autoconf/automake and compiler caches such as ccache. In short, SCons is an easier, more reliable and faster way to build software." Not a cross-platform library, but with some capabilities that way.

PTypes, a C++ Portable Types Library, "is a simple alternative to the STL that includes multithreading and networking. It defines dynamic strings, variants, character sets, lists and other basic data types along with portable thread and synchronization objects, IP sockets and named pipes. Its main `target audience' is developers of complex network daemons, robots or non-visual client/server applications of any kind."

POCO C++ Libraries: "a collection of open source C++ class libraries that simplify and accelerate the development of network-centric, portable applications in C++. The libraries integrate perfectly with the C++ Standard Library..."

dlib C++ Library: "a modern C++ library with a focus on portability and program correctness. It strives to be easy to use right and hard to use wrong."

The Coral Tree Library Set, particularly OSD. Appears geared toward game-writing, and has lots of stuff. Not sure how current it is.

P::Classes: "a portable, high performance C++ application framework which provides many classes needed for real-world application development, emphasing on ease of use, size and stability. Current highlights are: A type- and threadsafe signal/slot mechanism, an i/o system including a plugin-based architecture for network-protocol transparent i/o, a plugin-based application message logging framework, classes and driver-plugins to access sql databases, a message digest library, classes for configuration management." The top of the home page, posted 1/2005, says, "We are not dead!" But they seem to be.