Dynamic Language Bindings for C Libraries with emphasis on their application to R
by Daniel Adler
Date of Examination:2012-05-23
Date of issue:2013-10-31
Advisor:Prof. Dr. Walter Zucchini
Referee:Prof. Dr. Thomas Kneib
Referee:Prof. Dr. Carsten Damm
Files in this item
Name:adler2012.pdf
Size:3.89Mb
Format:PDF
Description:Dissertation
Abstract
English
Scripting languages are becoming increasingly prevalent as a tool for rapid application development. However, numerous efficient “best-practice” software solutions are initially available as C libraries. Scripting "bindings" to C libraries are typically implemented as C wrapper modules that need to be developed and compiled for every language-library-platform combination. We discuss a middleware architecture for scripting languages that provides for seamless dynamic scripting access to the C API of native libraries without the need for compilation of wrapper modules. We gave a proof-of-concept by example of an implementation for R in which C libraries, such as OpenGL and SDL, are loaded as if these were an extension to R. The model is based on automation for making arbitrary C APIs available and dynamic operations for interoperability with native code and data that are carried out at the machine level using a Dynamic Foreign Function Interface. The latter need to conform with the ABI (Application Binary Interface) and Calling Conventions of the processor hardware platform. We give an overview of ABIs across five processor-architecture families and we then discuss a portable abstraction layer for making foreign function calls and handling of callbacks. Detailed descriptions are given that explain the interface design as well as port implementations for X86, ARM, PowerPC, MIPS and SPARC processor-architecture families.
Keywords: R;middleware;scripting language;components;Foreign Function Interface;Generic Dynamic FFI;