ACM Home Page
Please provide us with feedback. Feedback
Automatic generation of library bindings using static analysis
Full text PdfPdf (832 KB)
Source
Conference on Programming Language Design and Implementation archive
Proceedings of the 2009 ACM SIGPLAN conference on Programming language design and implementation table of contents
Dublin, Ireland
SESSION: Program analysis and invariants table of contents
Pages 352-362  
Year of Publication: 2009
ISBN:978-1-60558-392-1
Also published in ...
Authors
Tristan Ravitch  University of Wisconsin-Madison, Madison, WI, USA
Steve Jackson  University of Wisconsin-Madison, Madison, WI, USA
Eric Aderhold  University of Wisconsin-Madison, Madison, WI, USA
Ben Liblit  University of Wisconsin-Madison, Madison, WI, USA
Sponsors
SIGPLAN: ACM Special Interest Group on Programming Languages
ACM: Association for Computing Machinery
Publisher
ACM  New York, NY, USA
Bibliometrics
Downloads (6 Weeks): 26,   Downloads (12 Months): 106,   Citation Count: 0
Additional Information:

abstract   references   index terms   collaborative colleagues  

Tools and Actions: Request Permissions Request Permissions    Review this Article  
DOI Bookmark: Use this link to bookmark this Article: http://doi.acm.org/10.1145/1542476.1542516
What is a DOI?

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.


REFERENCES

Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.

1
 
2
L. O. Andersen. Program Analysis and Specialization for the C Programming Language. PhD thesis, DIKU, Department of Computer Science, University of Cophenhagen, May 1994.
 
3
 
4
D. M. Beazley. Simplified wrapper and interface generator. http://www.swig.org, Nov. 2008.
 
5
E. Busboom, A. Cancro, and W. Goesgens. libical. http://freeassociation.sourceforge.net/, Nov. 2008.
6
 
7
Ctypesgen Developers. ctypesgen. http://code.google.com/p/ctypesgen/, Nov. 2008.
8
 
9
M. Elder, S. Jackson, and B. Liblit. Code sandwiches. Technical Report 1647, University of Wisconsin-Madison, Oct. 2008.
10
11
 
12
J. Gailly and M. Adler. zlib home site. http://zlib.net/, Nov. 2008.
 
13
M. Galassi, J. Davies, J. Theiler, B. Gough, G. Jungman, M. Booth, and F. Rossi. GNU Scientific Library Reference Manual. Network Theory Ltd., Bristol, United Kingdom, revised second edition, Aug. 2006.
 
14
The GNOME Project. GNOME Bug Tracking System. http://bugzilla.gnome.org, Jan. 2009.
 
15
16
17
 
18
T. Heller. ctypeslib -- useful additions to the ctypes FFI library. http://pypi.python.org/pypi/ctypeslib/, Nov. 2008.
 
19
S. Jaroszewicz. ctypesGSL. http://www.cs.umb.edu/sj/ctypesGsl/, Aug. 2008.
 
20
T. Kientzle. libarchive. http://people.freebsd.org/~kientzle/libarchive/, Nov. 2008.
 
21
 
22
C. Lattner. LLVM and Clang: Next generation compiler technology. In BSDCan 2008: The BSD Conference, Ottawa, Canada, May 2008.
 
23
 
24
A. Makhorin. GLPK (GNU linear programming kit). http://www.gnu.org/software/glpk/, Nov. 2008.
 
25
M.-T. Pham. ctypes-glpk: A Python wrapper for GLPK using ctypes. http://code.google.com/p/ctypes-glpk, Nov. 2008.
26
27
 
28
J. Seward. bzip2. http://www.bzip.org/, Nov. 2008.
 
29
Silicon Graphics, Inc. libacl. http://oss.sgi.com/projects/xfs/, Feb. 2008.
 
30
Silicon Graphics, Inc. libattr. http://oss.sgi.com/projects/xfs/, Feb. 2008.

Collaborative Colleagues:
Tristan Ravitch: colleagues
Steve Jackson: colleagues
Eric Aderhold: colleagues
Ben Liblit: colleagues