Last updated
TnFOX portability toolkit
Developer(s) Niall Douglas
Final release
0.88.1 [1]   OOjs UI icon edit-ltr-progressive.svg / 24 March 2010;11 years ago (24 March 2010)
Written in C++, Python
Operating system Cross-platform
Type Development Library
License GNU Lesser General Public License

The TnFOX portability toolkit is a fork of the FOX GUI toolkit with most of the added code implementing orthogonal features (i.e. not substantially changing the FOX API) such that applications developed for FOX can be easily recompiled for TnFOX. Unusually, TnFOX also contains API emulations of some Qt library classes - according to the author, this was done to port a substantial project from Qt to FOX. Most of the added features implement a full "portability toolkit" library such that one can write one program to run anywhere - this differs from FOX which mostly just provides the GUI portability alone. TnFOX is therefore an example of an operating system abstraction layer.


Unlike FOX, TnFOX supports only a restricted set of C++ compilers and operating systems. It only supports Microsoft's C++ compiler v7.1 and later, GCC v3.2 and later and Intel C++ compiler v8 or later. It also only runs on Windows 2000 or later, Linux 2.6 kernels or later, FreeBSD and Mac OS X 10.4 or later, though on any processor or architecture.

TnFOX contains its own automatically generated bindings for Python based on Boost.Python library - such were the complexity of these it required adding the -fvisibility feature to GCC v4 onwards. [2] However, the quality and state of these have languished in recent years.

The library is no longer maintained by its author, as of 2012. [3]

Substantial Features of TnFOX

One of the more original features of TnFOX is its heavy usage of C++ metaprogramming though this is entirely kept away from the GUI side of things (for FOX compatibility). A full lightweight metaprogramming toolkit is included which allows many of the operations provided by the Boost metaprogramming library, including typelists, type traits, compile-time logic, functors, virtual table compilation, horizontal type list instantiation and more. Unlike Boost, due to the requirement for a modern C++ compiler, all the metaprogramming operates consistently across compilers without the need for ugly macros.

Another unusual feature is the use of pervasive exception handling and safety whereby any line is assumed to always potentially throw an exception. TnFOX provides a C++ rollback mechanism (as originally proposed by Andrei Alexandrescu) to keep track of what operations need to be undone at any given stage should an error occur - rather like a SQL transaction. One problem with this approach is the possibility of nested exception throws during object destruction which under the ISO C++ standard requires an immediate program termination - TnFOX works around this problem via preprocessing of the source to add extra support code.

A quirky addition of the v0.88 release is to use Google Translate to convert its locale strings. While of dubious utility, especially for shorter strings, it nevertheless may save time during translations.

Unlike most portability toolkits, TnFOX has been very extensively profiled and performance tuned for maximum speed and minimal memory usage. It has strong multithreading support including tuning to avoid two threads writing to the same cache line (which causes cache line bouncing and greatly bottlenecks parallel throughput). It optionally uses its own thread caching memory allocator, automatically uses dynamic algorithms which will trade speed for memory usage according to memory low conditions and has very strong x86 and x64 specific optimisations including a metaprogramming implementation of SIMD vectors which will automatically compile down into SSE operations (right up to SSE4 support). It has its own assembler written fast mutex implementation, extensive internal caching to avoid syscalls to the kernel and its own inter-process communication framework which can transport arbitrary C++ object instances from one place to another by leveraging metaprogramming to automatically implement serialisation & deserialisation. This is particularly evident in its SQL database interface where one can simply bind an arbitrary C++ object instance to a BLOB field and no further code is required.

TnFOX optionally includes copies of the OpenSSL library and the SQLite library in order to implement its strong encryption and its default SQL database implementation respectively. It can be built modularly as a set of separate DLLs or monolithically. It also has full portable support for host operating system ACL security and knows how to protect sensitive data from entering the swap file, plus automatically shredding any deleted portions. It can access which user is running the process and how to escalate its privileges as necessary.

It has a no GUI build suitable as a portability toolkit for daemon and system processes. This has no X11/GDI dependencies.

TnFOX has already begun to add C++0x features for those compilers which support them - this being the next revision of the ISO C++ standard.

See also

Related Research Articles

Qt (software) Object-oriented framework for GUI creation

Qt is a widget toolkit for creating graphical user interfaces as well as cross-platform applications that run on various software and hardware platforms such as Linux, Windows, macOS, Android or embedded systems with little or no change in the underlying codebase while still being a native application with native capabilities and speed.

Single instruction, multiple data Type of parallel processing

Single instruction, multiple data (SIMD) is a type of parallel processing in Flynn's taxonomy. SIMD can be internal and it can be directly accessible through an instruction set architecture (ISA), but it should not be confused with an ISA. SIMD describes computers with multiple processing elements that perform the same operation on multiple data points simultaneously.

In computing, cross-platform software is computer software that is designed to work in several computing platforms. Some cross-platform software requires a separate build for each platform, but some can be directly run on any platform without special preparation, being written in an interpreted language or compiled to portable bytecode for which the interpreters or run-time packages are common or standard components of all supported platforms.


wxWidgets is a widget toolkit and tools library for creating graphical user interfaces (GUIs) 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. A wide choice of compilers and other tools to use with wxWidgets facilitates development of sophisticated applications. wxWidgets supports a comprehensive range of popular operating systems and graphical libraries, both proprietary and free, and is widely deployed in prominent organizations.

SSE2 is one of the Intel SIMD processor supplementary instruction sets first introduced by Intel with the initial version of the Pentium 4 in 2000. It extends the earlier SSE instruction set, and is intended to fully replace MMX. Intel extended SSE2 to create SSE3 in 2004. SSE2 added 144 new instructions to SSE, which has 70 instructions. Competing chip-maker AMD added support for SSE2 with the introduction of their Opteron and Athlon 64 ranges of AMD64 64-bit CPUs in 2003.

Standard Widget Toolkit

The Standard Widget Toolkit (SWT) is a graphical widget toolkit for use with the Java platform. It was originally developed by Stephen Northover at IBM and is now maintained by the Eclipse Foundation in tandem with the Eclipse IDE. It is an alternative to the Abstract Window Toolkit (AWT) and Swing Java graphical user interface (GUI) toolkits provided by Sun Microsystems as part of the Java Platform, Standard Edition (J2SE).


Fast Light Toolkit is a cross-platform widget library for graphical user interfaces (GUIs), developed by Bill Spitzak and others. Made to accommodate 3D graphics programming, it has an interface to OpenGL, but it is also suitable for general GUI programming.


PyQt is a Python binding of the cross-platform GUI toolkit Qt, implemented as a Python plug-in. PyQt is free software developed by the British firm Riverbank Computing. It is available under similar terms to Qt versions older than 4.5; this means a variety of licenses including GNU General Public License (GPL) and commercial license, but not the GNU Lesser General Public License (LGPL). PyQt supports Microsoft Windows as well as various flavours of UNIX, including Linux and MacOS.

Fox toolkit

The FOX toolkit is an open-source, cross-platform widget toolkit, i.e. a library of basic elements for building a graphical user interface (GUI). FOX stands for Free Objects for X.

PHP-GTK PHP library for GTK+ GUI applications

PHP-GTK is a set of language bindings for PHP which allow GTK GUI applications to be written in PHP. PHP-GTK provides an object-oriented interface to GTK classes and functions. While PHP-GTK partially supports GTK2, GTK3 is not supported at all.

GLib Software library

GLib is a bundle of three low-level system libraries written in C and developed mainly by GNOME. GLib's code was separated from GTK, so it can be used by software other than GNOME and has been developed in parallel ever since.

gtkmm is the official C++ interface for the popular GUI library GTK. gtkmm is free software distributed under the GNU Lesser General Public License (LGPL).

The Visual Component Framework (VCF) is an abandoned open source project for development under Microsoft Windows and Apple Macintosh that is distributed under the BSD license. It is an advanced C++ application framework that makes it easier to produce GUI-based C++ applications. The framework is C++ design and has built in support for rapid application development. The framework is designed to be portable over multiple platforms and compilers.


JUCE is a partially open-source cross-platform C++ application framework, used for the development of desktop and mobile applications. JUCE is used in particular for its GUI and plug-ins libraries.

fpGUI Graphical user interface toolkit in Object Pascal

fpGUI, the Free Pascal GUI toolkit, is a cross-platform graphical user interface toolkit developed by Graeme Geldenhuys. fpGUI is open source and free software, licensed under a Modified LGPL license. The toolkit has been implemented using the Free Pascal compiler, meaning it is written in the Object Pascal language.


Ultimate++, also known as U++ or Upp - is a C++ rapid application development framework which aims to reduce the code complexity of typical desktop applications by extensively exploiting C++ features. Programs created with it can work on multiple operating systems and hardware architectures without the need to write platform specific code.

SIP is an open source software tool used to connect computer programs or libraries written in C or C++ with the scripting language Python. It is an alternative to SWIG.

mpv (media player) Free and open-source media player software

mpv is free and open-source media player software based on MPlayer, mplayer2 and FFmpeg. It runs on several operating systems, including the Unix-like operating systems and the non-Unix Microsoft Windows, along with having an Android port called mpv-android. It is cross-platform, running on ARM, PowerPC, x86/IA-32, x86-64, and MIPS architecture.

Nana is a cross-platform C++ library for creating graphical user interfaces. It uses a platform-independent API and currently supports Windows, Linux and FreeBSD.


  1. "Release 0.88.1". 24 March 2010. Retrieved 23 July 2018.
  2. ned Productions - GCC Symbol Visibility Patch
  3. See March 2012 comment by Niall Douglas: There hasn't been much work on TnFOX in recent years ... Probably, and sadly, most of the 40,000+ lines of my own code in TnFOX will be left to bit rot.