If the current image does not contain a copy of a routine, the ZLINK command adds an executable GT.M routine to the current image. If the current image contains a copy of a routine and the routine is not active, the ZLINK command replaces the current routine image with a "new" version. If necessary, the ZLINK command compiles the routine prior to integrating it with the image.
The format of the ZLINK command is:
ZL[INK][:tvexpr] [expr1[:expr2][,...]]
The optional truth-valued expression immediately following the command is a command postconditional that controls whether or not GT.M executes the command.
The optional first expression specifies the file-specification of a routine to ZLINK; if ZLINK has an argument, it not only adds the routine to the image, but also sets $ZSOURCE=expr.
If ZLINK has no argument, or expr1="", it uses value of $ZSOURCE as the routine ; at least two (2) spaces must follow a ZLINK command with no argument to separate it from the next command on the line.
The optional second expression specifies a string holding MUMPS command qualifiers delimited by a slash (/); the qualifiers control compile options when the current ZLINK requires a compile; if ZLINK omits the second expression, the command uses the $ZCOMPILE intrinsic special variable to determine the compile qualifiers.
An indirection operator and an expression atom evaluating to a list of one or more ZLINK arguments form a legal argument for a ZLINK.
ZLINK cannot change a routine that GT.M is currently executing. An attempt to ZLINK an active routine results in a run-time error because changing a routine in progress could have unpredictable results. Before ZLINKing the routine, use the ZSHOW command to display the currently active routines, then remove it from the GT.M stack using ZGOTO, or the appropriate number of QUITs.
When the ZLINK command specifies a file, GT.M sets $ZSOURCE to that file-specification. By default, ZLINK and ZEDIT use $ZSOURCE for a specification when they have a missing or null argument. A subsequent ZLINK without an argument is equivalent to ZLINK $ZSOURCE. For more information on $ZSOURCE, refer to the appropriate section in the "Intrinsic Special Variables" chapter in this manual.
Because RMS does not permit the percent sign (%) in a file name, use an underscore (_) in place of the percent in the ZLINK file-specification for routines beginning with a percent sign.
In order to ensure compatibility with GT.M versions that do not permit the percent sign (%) in a file name, use an underscore (_) in place of the percent in the ZLINK file name for routines beginning with a percent sign. |
If the expression includes an explicit directory, ZLINK searches only that directory. Otherwise, if $ZROUTINES is not null, a ZLINK command uses $ZROUTINES to locate files. If $ZROUTINES is null, ZLINK uses the current directory. For more information on $ZROUTINES, refer to the appropriate section in the "Intrinsic Special Variables" chapter in this manual.
If the file-specification contains an explicit file type (extension), ZLINK processes the file according to the type, object (.OBJ) or source (usually .M.). If the file-specification does not specify a file type, ZLINK attempts to find and match both the object and source for a routine.
The following table illustrates how ZLINK processes the three possibilities of file extension.
ZLINK Operation Summary |
|||
EXTENSION SPECIFIED |
EXTENSION SOUGHT BY ZLINK |
RESULT |
|
.OBJ |
.M |
||
.OBJ |
found |
link only |
|
not found |
error |
||
.M or None |
not found |
found |
compile and link |
found |
not found |
link only |
|
not found |
not found |
error |
|
found .OBJ file newer than .M and version okay |
found .M file older than .OBJ |
link only |
|
found .OBJ file older than .M or version mismatch |
found .M file newer than .OBJ |
compile and link |