Up Top       Prev External calls:      Next System


SmallEiffel Help: Cecil

How to call Eiffel features from a C program

Read this item if you want to call some Eiffel features from C code (to call C functions/macros from Eiffel see external).

In order to call an Eiffel feature from C, you must use the -cecil cecil_file option with compile or compile_to_c. The cecil_file allows you to give the list of features you want to call from C.

When the -cecil option is used, compile_to_c generates an additional C heading file which includes the necessary C prototypes.

The cecil_file must have at least two lines. The first line is the name of the C heading file to produce (it may be useful if you need to create a C library). Other lines have the following structure:

c_name active_type feature_name
C_name is the name of the C function defined by compile_to_c to wrap the Eiffel call. The pair active_type feature_name gives the complete name of the Eiffel feature to call.

Bear in mind that the active_type must really be present. If active_type is ARRAY[INTEGER] for example, your Eiffel program is suppose to create at least one ARRAY[INTEGER].

The name of the feature to call, feature_name, may be an infix or a prefix feature name (the syntax is the same as that used in Eiffel source).

As cecil_file is parsed by the SmallEiffel parser, it may contain Eiffel comments.

See examples in the directory SmallEiffel/lib_show/cecil/example*.



Up Top       Prev External calls:      Next System



This page was last changed by Oliver Elphick on 3rd August 1997.