next up previous contents
Next: 8.2 Alien Types Up: 8 Alien Objects Previous: 8 Alien Objects

8.1 Introduction to Aliens

Because of Lisp's emphasis on dynamic memory allocation and garbage collection, Lisp implementations use unconventional memory representations for objects. This representation mismatch creates problems when a Lisp program must share objects with programs written in another language. There are three different approaches to establishing communication:

CMU Common Lisp relies primarily on the automatic conversion and direct manipulation approaches: Aliens of simple scalar types are automatically converted, while complex types are directly manipulated in their foreign representation. Any foreign objects that can't automatically be converted into Lisp values are represented by objects of type alien-value. Since Lisp is a dynamically typed language, even foreign objects must have a run-time type; this type information is provided by encapsulating the raw pointer to the foreign data within an alien-value object.

The Alien type language and operations are most similar to those of the C language, but Aliens can also be used when communicating with most other languages that can be linked with C.


next up previous contents
Next: 8.2 Alien Types Up: 8 Alien Objects Previous: 8 Alien Objects

Raymond Toy
Mon Jul 14 09:11:27 EDT 1997