This paper proposes a foreign function interface seemlessly connecting ML style functional programming language with C. With this interface, a programmer can import and use C functions operating not only on base types such as int and double but also function pointers without writing complicated stub or wrapper functions. This is realized by the combination of a type-directed compilation method that achieves the same runtime data representation for primitive data types including integers and floating point numbers as those of C, and foreign language interface that enables for ML functions to call C functions and for C functions to call back ML functions. This paper reports the design, underlying theory, and implementation techniques for the foreign language interface. The mechanism reported in this article has been implemented in the SML# compiler, which is made available as an open source software.
|Number of pages||27|
|Publication status||Published - 2010 May 1|
ASJC Scopus subject areas