Thursday, May 28, 2009

APR == Apache Portable Runtime 簡介

APR == Apache Portable Runtime 簡介
APR 是Apache Portable Runtime的縮寫。APR本來主要目的在於將Apache系統中與作業系統相關的實作部分獨立出來,另外提供一與OS無關的應用程式介面(API,Application Programming Interface)供程式設計者使用,也就是模擬出一個虛擬的OS介面,其主要針對Thread、Process、Directories等功能進行虛擬化。如此一來,可以在不需大量變動原始程式碼即可輕易達到將Apache軟體移植至其他的作業系統上。如果要將所開發的程式移植到新的作業系統上,程式設計者只要在新的作業系統上實作APR所提供的的介面,就可以達到將開發的程式輕易地移植到其他 作業系統 上。

由APR的全名就可以知道,APR原本是屬於Apache的一部份,但是自從Apache 1.3版之後已經被獨立成為一個單獨的project,當然除了Apache之外,也有許多軟體是以APR為基礎或是使用APR進行開發,達到 platform independent。著名的軟體專案包括:Subversion等等。

APR 大致上可以分了兩個部分,分別為APR Core與APR Util。APR Core包含了最基本的portable functions,Apr Util則包含其他不屬於Core但也必須是portable的functions。以下針對APR Core與APR Util分別描述所提供的功能。

APR Core提供了以下功能:

* Reading and writing files
* Character set conversion
* Network communications with sockets
* Time management used for Internet type conversions
* String manipulation like C++ including neural order management
* UNIX password management routines
* Table management routines
* UUID Internet generation
* Filename canonicalization
* Random data generation
* Global lock management
* Threads and process management
* Dynamic library loading routines
* Memory mapped and shared memory

APR Util提供了以下的功能:

參考資料

* Apache Portable Runtime Project
* APR Networking & the Reactor Pattern : Native-code portability for C/C++ programmers
* APR tutorial

No comments: