Lisp/C Integration in Eclipse

Howard R. Stearns
Elwood Corporation
Copyright © 1998, Elwood Corporation
[This paper was presented at the 40th Anniversary of Lisp Conference, November 17, 1998, Berkeley, CA.]


The Eclipse Common Lisp system serves as a Lisp-to-C translator, an extendible Lisp library for C programmers, and a complete traditional top-level Lisp system implemented in portable C. Using Eclipse, hand-written or system-generated C calls to Lisp look like ordinary C function calls, and Lisp data can be manipulated as ordinary C data by programs. Conversely, C function calls look like ordinary function calls within Lisp programs. We describe how this is used, the technology that implements it, and list related work.
1: Introduction
2: Core Technologies
2.1: Identifiers
2.2: Representation
2.2.1: Objects
2.2.2: Functions
2.2.3: Multiple Values
2.2.4: Dynamic Environment
2.2.5: C Implementations
2.3: Memory Management
2.4: Function-Based Interface
2.4.1: CLOS-MOP
2.4.2: Initialization
3: Using Lisp from C
3.1: Direct Calls
3.2: Funcall
3.3: Example Of Generated Code
3.5: Other Lisp Utilities and Their Effect on Calling Lisp Functions
3.5.1: Eval
3.5.2: Load
3.5.3: Passing Lisp Data
4: Using C from Lisp
5: Past And Future
5.1: Related Work
5.2: Planned Work

1: Introduction

Eclipse Common Lisp is a commercial implementation that makes the full ANSI language definition [Ansi] available to programmers in two ways: as a traditional top-level program featuring a read-eval-print loop, and as a C-callable library.[Stearns] The library uses normal C naming and function-calling conventions, is suitable for use directly by C programmers, and was used to implement the top-level program. In addition, the library and top-level contain a definition of COMPILE-FILE that generates human-readable, lintable C code that can be compiled and linked with the library. The generated code shares the same naming and calling conventions as the library, and, in fact, was used to generate the library C source code from Lisp source code.

This language implementation strategy provides the following benefits:

What follows is a description of how this is accomplished. Section 2 describes the core technologies Eclipse uses to integrate Lisp and C. Section 3 describes how Eclipse allows Lisp utilities to be used from C code, and gives an example of generated code. Section 4 describes how C utilities are used from Lisp code. Section 5 lists related work and suggests where this technology might be headed.

[Paper Contents] [Next] [Eclipse Home Page]