creates a module in which you can use ISO Standard Prolog4, but not all of ECLiPSe's usual language features. Note that the third argument (here iso) simply specifies a library which implements the desired language, so new languages can be added easily.:- module(mystdcode, [], iso).
and are executed just after the module containing them has been loaded.:- local initialization(Goal).
and are executed whenever the module containing the declaration gets imported into another module. The call will happen in the context of the importing module.:- export initialization(Goal).
and are executed just before the module containing them gets erased. Modules can get erased either explicitly through erase_module/1 or implicitly when the module is re-compiled, or when the ECLiPSe session is exited. Finalization goals should not do any I/O because in the case of an embedded ECLiPSe, I/O may no longer be available at finalization time.:- local finalization(Goal).
Once a module implementation is stable and there is a need for privacy, it is possible to lock a module. Locking makes it impossible to access internal, local items from outside the module. Of course, the module can still be used though its interface. The built-in predicates related to locking are lock/0 which provides a definitive lock, lock_pass/1 which allows subsequent unlocking using a password ( unlock/2), and get_module_info/3 which allows to check whether a module is locked. lock/0 and lock_pass/1 are usually used as a directive in the source file of the module to be locked.:- spy(p/3)@othermod.