ACM Home Page
Please provide us with feedback. Feedback
Calling variadic functions from a strongly-typed language
Full text PdfPdf (274 KB)
Source
International Conference on Functional Programming archive
Proceedings of the 2008 ACM SIGPLAN workshop on ML table of contents
Victoria, BC, Canada
SESSION: Session 2 table of contents
Pages 47-58  
Year of Publication: 2008
ISBN:978-1-60558-062-3
Authors
Matthias Blume  Toyota Technological Institute, Chicago, IL, USA
Michael Rainey  University of Chicago, Chicago, IL, USA
John Reppy  University of Chicago, Chicago, IL, 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): 3,   Downloads (12 Months): 30,   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/1411304.1411312
What is a DOI?

ABSTRACT

The importance of providing a mechanism to call C functions from high-level languages has been understood for many years and, these days, almost all statically-typed high-level-language implementations provide such a mechanism. One glaring omission, however, has been support for calling variadic C functions, such as printf. Variadic functions have been ignored because it is not obvious how to give static types to them and because it is not clear how to generate calling sequence when the arguments to the function may not be known until runtime. In this paper, we address this longstanding omission with an extension to the NLFFI foreign-interface framework used by Standard ML of New Jersey (SML/NJ) and the MLton SML compiler. We describe two different ways of typing variadic functions in NLFFI and an implementation technique based on the idea of using state machines to describe calling conventions. Our implementation is easily retargeted to new architectures and ABIs, and can also be easily added to any HOT language implementation that supports calling C functions.


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
The ATerm Programming Guide. Available from http://homepages.cwi.nl/~daybuild/daily-books/technology/aterm-guide/aterm-guide.html.
2
 
3
Blume, M. No-longer-foreign: Teaching an ML compiler to speak C "natively". In N. Benton and A. Kennedy (eds.), Proceedings of the First International Workshop on Multi-Language Infrastructure and Interoperability (BABEL'01), vol. 59 of Electronic Notes in Theoretical Computer Science, New York, NY, September 2001. Elsevier Science Publishers. Available from http://www.elsevier.nl/locate/entcs/volume59.html.
 
4
Chakravarty, M. M. T., S. Finne, F. Henderson, M. Kowalczyk, D. Leijen, S. Marlow, E. Meijer, S. Panne, S. Peyton Jones, A. Reid, M. Wallace, and M. Weber. The Haskell 98 foreign function interface 1.0: An addendum to the Haskell 98 Report. Available from http://www.cse.unsw.edu.au/~chak/haskell/ffi/, 2003.
 
5
6
 
7
Fisher, K., R. Pucella, and J. Reppy. Data-level interoperability. Technical report, Bell Labs, Lucent Technologies, April 2000. Available from http://moby.cs.uchicago.edu.
 
8
Fisher, K., R. Pucella, and J. Reppy. A framework for interoperability. In N. Benton and A. Kennedy (eds.), Proceedings of the First International Workshop on Multi-Language Infrastructure and Interoperability (BABEL'01), vol. 59 of Electronic Notes in Theoretical Computer Science, New York, NY, September 2001. Elsevier Science Publishers. Available from http://www.elsevier.nl/locate/entcs/volume59.html.
 
9
10

Collaborative Colleagues:
Matthias Blume: colleagues
Michael Rainey: colleagues
John Reppy: colleagues