ECLiPSe runs as a special thread (we will call it ECLiPSe engine) within your application, maintaining its own execution state. This section is about when and how to initialise it. There are parameters to be applied before initialisation, but these are usually acceptable. These parameters are described in Appendix A.
Although it is useful to think of ECLiPSe as a thread, it is not an operating system thread, but is rather implemented as a set of C functions that maintain some state. This state is the complete execution state of the ECLiPSe engine, its stack of goals, its success and failure continuations and its global stack of all constructed data.
At particular points during its execution ECLiPSe will yield control back to the C level. This is implemented by returning from a function. ECLiPSe can then be restarted from the exact point it left off. This is implemented by a function call.
You initialise ECLiPSe by calling the parameterless function
int ec_init();
A process should do this just once. ec_init
returns 0 on success or
-1 if an error occurred. It is possible to influence the initialisation of
ECLiPSe by setting initialisation options as described in
Appendix A.
None of the functions of the interface work before this initialisation. In particular in C++, if you use static variables which are constructed by calling ECLiPSe functions you must arrange for the initialisation to occur before the constructors are called.