Abstract
This paper discusses a new method for typed functional languages to access libraries written in a lower-level language. More specifically, it introduces an interfacing tool that eases Haskell access to C libraries. The tool obtains information about the C data type definitions and function signatures by analysing the C header files of the library. It uses this information to compute the missing details in the template of a Haskell module that implements a Haskell binding to the C library. Hooks embedded in the binding file signal where, which, and how C objects are accessed from Haskell. The Haskell code in the binding file determines Haskell type signatures and marshaling details. The approach is lightweight and does not require an extra interface description language.
This work was conducted, in large part, while working at the Institute of Information Sciences and Electronics, University of Tsukuba, Japan.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Beazley, D.M.: SWIG and automated C/C++ scripting. Dr. Dobb’s Journal (February 1998)
Chakravarty, M.M.T.: A compiler toolkit in Haskell (1999), http://www.cse.unsw.edu.au/~chak/haskell/ctk/
Chakravarty, M.M.T.: A GTK+ binding for Haskell (1999), http://www.cse.unsw.edu.au/~chak/haskell/gtk/
Chakravarty, M.M.T.: Lazy lexing is fast. In: Middeldorp, A., Sato, T. (eds.) Proceedings of the 4th Fuji International Symposium on Functional and Logic Programming. LNCS. Springer, Heidelberg (1999)
Finne, S., Leijen, D., Meijer, E., Jones, S.P.: Calling hell from heaven and heaven from hell. In: Proceedings of the ACM SIGPLAN International Conference on Functional Programming. ACM Press, New York (1999)
Finne, S., Leijen, D., Meijer, E., Jones, S.L.P.: H/Direct: A binary foreign language interface for Haskell. In: Proceedings of the ACM SIGPLAN International Conference on Functional Programming (ICFP 1998), pp. 153–162. ACM Press, New York (1998)
Harlow, E.: Developing Linux. Applications with GTK+ and GDK. New Riders Publishing, Indianapolis (1999)
Jones, S.P., Marlow, S., Elliott, C.: Stretching the storage manager: Weak pointers and stables names in Haskell. In: Proceedings of the International Conference on Functional Programming (1999)
Nordin, T., Jones, S.L.P., Reid, A.: Green Card: a foreign-language interface for Haskell. In: Proceedings of the Haskell Workshop (1997)
The common object request broker: Architecture and specification, rev. 2.2. Technical report, Object Management Group, Framingham, MA (1998)
Pennington, H.: GTK+/Gnome Application Development. New Riders Publishing, Indianapolis (1999)
Jones, S.L.P., Wadler, P.: Imperative functional programming. In: ACM Symposium on Principles of Programming Languages, pp. 71–84. ACM Press, New York (1993)
Haskell 98: A non-strict, purely functional language (February 1999), http://haskell.org/definition/
Swierstra, S.D., Duponcheel, L.: Deterministic, error-correcting combinator parsers. In: Launchbury, J., Sheard, T., Meijer, E. (eds.) AFP 1996. LNCS, vol. 1129, pp. 184–207. Springer, Heidelberg (1996)
The Haskell FFI Team. A primitive foreign function interface (1998), http://www.dcs.gla.ac.uk/fp/software/hdirect/ffi.html
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2000 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Chakravarty, M.M.T. (2000). C \(\longrightarrow\) HASKELL, or Yet Another Interfacing Tool. In: Koopman, P., Clack, C. (eds) Implementation of Functional Languages. IFL 1999. Lecture Notes in Computer Science, vol 1868. Springer, Berlin, Heidelberg. https://doi.org/10.1007/10722298_8
Download citation
DOI: https://doi.org/10.1007/10722298_8
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-67864-9
Online ISBN: 978-3-540-44658-3
eBook Packages: Springer Book Archive