Introduction

Melange is an automatic interface generator which provides transparent access to both functions and data defined or generated by existing C libraries. It allows users to import “interfaces” [1] from existing C header files, controlled by the contents of a define interface top-level form which may be included in the same file as arbitrary Dylan code. The user may use the functions and data specified by this interface as if they were native Dylan objects, and may export them to other modules.

Melange provides reasonable interpretations for the various sorts of C declarations which may appear in a header file, as well as mechanisms for explicitly modifying the default interpretations when necessary. For example, users may:

  • specify rules for the translation of foreign names

  • explicitly specify new names for specific objects or routines

  • specify parameter passing conventions or mutability of foreign objects

  • specify mappings or equivalences between “foreign” data and native equivalents

  • choose to import only a subset of the declarations in the header file

All of these customizations, as well as the name of the C header file, are specified by a define interface clause. See A Concrete Example for an example.

Footnotes