Up Top       Prev Cecil calls:      Next System


About the generated C code



People who want or have to code part of their applications and/or libraries in C should really limit themselves to the clean interfaces provided by Cecil or the external mechanism. This page mentions some facts you should be aware of before you start.

Generated type names

First and foremost, SmallEiffel generates one unique type name in the C code for each active type present in the Eiffel code. This type is of the form Txyz where xyz represents the number corresponding to the name of the type, including its parameters in the case of generic types. (More details about this in our research papers). When you compile your application, you can find them in a mangling table, somewhere in the C code, which looks like this:

D 2  T1489 R BOOLEAN_CONSTANT 210,253
A 1  T945  R BIT_CONSTANT 945
A*1  T218  R TAG_NAME 218
A 1  T602  R TYPE_BIT_1 602

But don't use this information ! The mangling table is only valid for one specific compilation of one specific application with one specific compiler and specific libraries...

Indeed, when computing a type code, collisions may occur, and affect this process. Thus, the number (and name) corresponding to each type depends not only on the type names, but also on the order in which they are compiled. That is, on the application and libraries compiled... They also depend on the compilation mode used, and the version of the compiler you're using.

Consequently, you must never, ever, rely on the type numbers/names in the generated C code, because they are not constant! (except for a few which have a fixed, hard-coded name). So don't bother writing in your own C code things such as new123 or T456, because the only thing we guarantee in this case is that your code will break sooner or later ... probably sooner.



Copyright © Dominique COLNET and Suzanne COLLIN - <colnet@loria.fr>
Last update: Monday December 7th, 1998, by OZ.



Up Top       Prev Cecil calls:      Next System



This page was last changed for the Debian distribution of SmallEiffel by Oliver Elphick on 28th December 1998.