CECIL: using Eiffel from other languages

Eiffel Power (TM) from ISE Important note: this document is regularly updated (corrections, examples, bug report, suggestions from customers). Please make sure that you have downloaded the latest version.

This document provides an overview of the C-Eiffel Call-In Library (CECIL) as defined in Eiffel: The Language (ETL). The first section adresses how to compile and run a CECIL program. The second part contains a more precise description of the Eiffel types, the protection mechanism as well as how to write and use C externals.

CECIL , designed by ISE, is the C library that permits C and C++ applications (as well as applications written in other languages) to take advantage of almost all Eiffel facilities: create Eiffel objects, apply features to them. The basics of CECIL are described in chapter 24 of the reference book on Eiffel, Eiffel: The Language, which covers interfaces between Eiffel and other languages. Important material can also be found in the ISE manual Eiffel: The Environment and on ISE's FTP server. In particular, the FTP server contains a complete example which you are strongly encouraged to download if you plan to make serious use of CECIL. You can find the examples in

(This is a zip of the entire example directory. You can also retrieve individual files from that directory by looking at ftp://ftp.eiffel.com/pub/examples/cecil and ignoring cecil.zip.)

The CECIL documentation, man pages and examples are part of the standard delivery with the ISE Compiler 4.5 and higher.

The present document complement the descriptions of Eiffel: The Language. Note that CECIL has been revised and improved since that book was published, so the explanations below have precedence over those of the book.

This document is intended for both Windows and Unix users. Only a few of the sections, clearly marked, are platform-specific.

Once unzipped, the example directory cited above will yield (apart from a README containing the same material as the present document) two subdirectories: unix-examples and windows-examples. Each contains a full example, adapted to each platform and illustrating the use of CECIL. Please study it carefully and use it as a model. When compiling a CECIL example , you must include `eif_eiffel.h' (for all the cecil features) and `eif_setup.h' (for the run-time initialization and reclaim).

Index

Introduction
Index
How to run a CECIL program

How to run a CECIL program

1 - Using CECIL

2 - Compiling your Eiffel system for CECIL

3 -Building a CECIL archive

4 - Using a CECIL archive

4.1 - Linking the CECIL archive into a program

4.2 - Initializing the Eiffel 4 run-time

5 - Restrictions

6 - Notes

Overview of the CECIL Interface

1 - Eiffel basic types

1.1 - More about EIF_OBJECT, EIF_REFERENCE, and basic expanded types

Back to index

2 - Protecting the Eiffel objects

Back to index

2.1 - Eiffel objects passed in a C external

Back to index

2.2 - Accessing the direct reference to an Eiffel object: eif_access

2.3 - Keeping a reference from C after an external call: eif_adopt

3 - Other CECIL functions:

3.1 - Creating Eiffel objects from C: eif_create

3.2 - Protecting the objects returned by Eiffel functions.

3.3 - Getting the type id of an Eiffel type: eif_type_id

 3.4 - Getting the type id of a generic type : eif_generic_type.

3.5 - Raising an eiffel panic: eif_panic.

3.6 - Releasing an Eiffel indirection pointer: eif_wean

3.7 - Getting the attribute from an Eiffel object: eif_attribute

3.8 - Getting the address of an Eiffel routine

3.9 - Enabling/Disabling the visible exception

3.10 - Creating an Eiffel string: eif_string

3.11 - Getting the return-type of an attribute: eif_attribute_type

3.12 - Getting the class name corresponding to a type id: eif_name

3.13 - Getting the type id of an Eiffel object: eif_type, eif_type_by_reference.

3.14 - Converting a C array into an Eiffel array: eif_make_from_c.

4 - Restrictions in CECIL

4.1 - Declaring routines taking real as argument

4.2 - Cast of the Eiffel routines in C.