Automatic generation of library bindings using static analysis
Tristan Ravitch, Steve Jackson, Eric Aderhold, and Ben Liblit

Abstract:

High-level languages are growing in popularity. However, decades of C software development have produced large libraries of fast, time-tested, meritorious code that are impractical to recreate from scratch. Cross-language bindings can expose low-level C code to high-level languages. Unfortunately, writing bindings by hand is tedious and error-prone, while mainstream binding generators require extensive manual annotation or fail to offer the language features that users of modern languages have come to expect.

We present an improved binding-generation strategy based on static analysis of unannotated library source code. We characterize three high-level idioms that are not uniquely expressible in C's low-level type system: array parameters, resource managers, and multiple return values. We describe a suite of interprocedural analyses that recover this high-level information, and we show how the results can be used in a binding generator for the Python programming language. In experiments with four large C libraries, we find that our approach avoids the mistakes characteristic of hand-written bindings while offering a level of Python integration unmatched by prior automated approaches. Among the thousands of functions in the public interfaces of these libraries, roughly 40% exhibit the behaviors detected by our static analyses.

Published:

"Automatic generation of library bindings using static analysis"
Tristan Ravitch, Steve Jackson, Eric Aderhold, and Ben Liblit.
Proceedings of the 2009 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI09) , Dublin, Ireland, June 2009.

Download:

Paper:

BibTeX Entry:

@article{1542516,
 author = {Ravitch, Tristan and Jackson, Steve and Aderhold, Eric and Liblit, Ben},
 title = {Automatic generation of library bindings using static analysis},
 journal = {SIGPLAN Not.},
 volume = {44},
 number = {6},
 year = {2009},
 issn = {0362-1340},
 pages = {352--362},
 doi = {http://doi.acm.org/10.1145/1543135.1542516},
 publisher = {ACM},
 address = {New York, NY, USA},
 }

Valid CSS! Valid HTML 4.01!