ModuleLoad - Maple Help

function to apply prior to loading a module

function to apply prior to deleting a module

 Calling Sequence module() export ModuleLoad, ...; ... end module; module() export ModuleUnload, ...; ... end module;

Description

 • If a ModuleLoad local or export is present, then this procedure is called when the module is read from the Maple repository in which it is located.
 • If a ModuleUnload local or export is present, then this procedure is called when the module is destroyed. A module is destroyed either when it is no longer accessible and is garbage collected, or when Maple exits.
 A module may be no longer accessible, and hence subject to garbage collection before the $\mathrm{ModuleUnload}$ procedure is executed, but become accessible again during the execution of that procedure. In this case, the module is not garbage collected. When it eventually is garbage collected or Maple exits, the ModuleUnload procedure is not executed again.
 • The ModuleLoad and ModuleUnload procedures are called with no arguments.
 • For the ModuleLoad option to perform correctly, the entire module in which it appears must be saved to the repository.  Also, if you save a member of a module that uses ModuleLoad and/or ModuleUnload, but do not save the module, then the specified procedure(s) will not be called.
 • An alternate name can be designated as ModuleLoad or ModuleUnload by using option load = lname and option unload = uname respectively, where lname and uname are exports or locals of the module.

Examples

This module is initialized by calling the procedure ModuleLoad when the module is read from a repository. It executes the procedure ModuleUnload when the module is garbage collected or Maple exits.

 Warning, (in P:-Area) i is implicitly declared local Loading module P
 > $P:-\mathrm{Area}\left(P:-\mathrm{NewTri}\left(\left[0,0\right],\left[2,0\right],\left[1,3\right]\right)\right)$
 ${3}$ (1)