Theory

In fact, since we slew the "calling Eiffel from Python" monster in the last chapter, we have a smaller task here than we thought. We only really need two things: first, the ability to initialize the Eiffel runtime from within Python; and second, the address of the root Eiffel class, so that we can script it from within Python to create the objects we need.

The first task is actually very simple: SmallEiffel provides a very handy initialize_eiffel_runtime function which takes standard (argc, argvector) arguments to start up the Eiffel runtime and initialize the root object. All we have to do is include that in our eiffel-glue.i file, and it should be exported along with the rest of the CECIL-exported functions.

The second task is simple as well: the eiffel_root_object, a void pointer, is also exposed through CECIL. Although neither of these functions are explicitly exported through the eiffel-glue.h header file, they can both be named as "external" features in the interface file. With that done, SWIG simply includes them in the module eiffel_gluemodule, and they are accessible from Python