Version 1.0 of the Apache Portable Runtime (APR) was released by the open-source software foundation on Thursday. The APR, primarily used as the base for the Apache 2.0 Web server, allows you to write applications to a single interface and run them on multiple platforms, including Unix, Linux and Windows.
APR is written entirely in C, and provides a common interface irrespective of the platform it's running on. This way, you only have to write your program once and simply recompile it on whatever platform you want it to run on. While it doesn't solve the problem of disparate user interface libraries, it provides predictable behaviour for the facilities it does provide.
Since it's really just a C library, you can use the APR with your existing C or C++ development tools without modification. There are some extra utilities and libraries available to use with APR, but you can use any other cross-platform libraries with the system.
Despite its server-based heritage, the Apache Foundation says it's just as useful for client-based applications: "APR was originally born of a server application, but it is very general. It can be and has been used to author client apps, servers, and strictly local applications alike." said Cliff Wooley, vice president for APR.
While other runtime systems, such as the Java Virtual Machine, the .Net and Mono project Common Language Runtimes are aimed at providing application portability, Wooley thinks that the APR has broader support and is more efficient. "With .Net CLR and Mono, you're currently more or less limited to Win32 or
Linux and x86. APR is all about broad cross-OS and cross-architecture portability. APR supports a broad variety of Unixes, Windows, Netware, Mac OS X, OS/2, and BeOS."
He also claims that because APR is written in C for each platform, it's less of a burden than other systems. "APR was designed in such a way that each platform can implement APR's interfaces in the most efficient way possible on that platform. That way you get all the benefits of a native implementation on a given platform without the overhead of lots of extra compatibility layers piled on top," commented Wooley.
APR can be downloaded from apr.apache.org