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:

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

The basic model for interface importation is based upon that used within Apple Computer's "Creole" interface generator. There are, however, significant differences in some of the details. (For instance, the "equate", "map", and "object-file" directives used in the above example are unique to Melange. Likewise, Creole's "type" directive would not be accepted by Melange) You should, therefore, not expect Creole interface declarations to work within Melange without some modification.

Notes

[1]

In fact, a C header file may contain arbitrary C code which Melange is unprepared to handle. By convention, however, ".h" files con tain only "interface declarations"—type declarations, function prototypes, global variable declarations, and "preprocessor constants." Since Melange can meaningfully process all of these, it is capable of handling the vast majority of header files which will be encountered in practice.