Computational Statistics

, Volume 24, Issue 2, pp 283–293 | Cite as

Working with meta-data from C/C++ code in R: the RGCCTranslationUnit package

  • Duncan Temple LangEmail author
Original Paper


This paper describes an R package that allows one to read and generate a description of C and C++ source code elements. These descriptions are meta-data about that C/C++ code and can be used for several different purposes. The most obvious application is to programmatically generate bindings/wrappers which are R functions and C routines that allow R users to invoke the original C/C++ routines from within R. We discuss the mechanics of the package and briefly outline one strategy for generating the mappings between R and arbitrary C/C++ code. We also illustrate how we can create new derived C++ classes, some or all of whose methods can be implemented in R via R functions. The meta-data can also be used to generate registration information for R’s dynamic symbol resolution, identify potential re-factoring for the removal of global variables (leading towards thread-safety), and generally collect data for software metrics and analysis. The package currently provides the primitives for reading and working with the meta-data, and has support for generating bindings for most of the common C and C++ constructs. Additional facilities such as determining memory management and computing call graphs from the body of a routine can be built on top of these primitives. Versions of the package are available at


Source Code Data Type Software Metrics Protected Method External Pointer 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. Beazley D et al (1998) SWIG—Simplified Wrapper Interface Generator. Februrary 1998
  2. Fraser C, Hanson D (1995) A retargetable C compiler: design and implementation. Addison-Wesley, USAzbMATHGoogle Scholar
  3. Insightful Corporation (2007) S-Plus.
  4. King B (2004) GCC-XML. February 2004
  5. Temple Lang D (2000) The RSPerl package for R. October 2000
  6. R Development Core Team (2006) Writing R extensions, R foundation for statistical computing, Vienna, Austria, October 2006 (ISBN 3-900051-11-9).
  7. R Development Core Team (2008) R: A language and environment for statistical computing. ISBN 3-900051-07-0.
  8. Steffen J, Bröker H-B (2000) cscope. April 2000
  9. Stallman RM, Tower L et al (1987) GNU compiler collection.
  10. The MathWorks (2007) MATLAB.
  11. van Rossum G, Drake FL (eds) (2001) Python reference manual. PythonLabs, VA, USAGoogle Scholar
  12. Winters A (2003) GCC::TranslationUnit Perl Module. September 2003
  13. Wall L, Christiansen T, Schwartz RL (2000) Programming Perl, 3rd edn. O’Reilly & Associates, Inc, WashingtonzbMATHGoogle Scholar

Copyright information

© Springer-Verlag 2008

Authors and Affiliations

  1. 1.Department of StatisticsUniversity of CaliforniaDavisUSA

Personalised recommendations