LINK

From Recital Documentation Wiki
Jump to: navigation, search

Purpose

Link multiple source program files into a single file


Syntax

LINK FROM <.dbl file> | <skeleton> TO <.src file>

[MESSAGE <.map file>]

[COMMAND <expC>]

[COMMENTS]


See Also

COMPILE, DO, FUNCTION, PROCEDURE, Recital Linker, SET PROCEDURE, SET PSHARE


Description

The LINK command is used to invoke the Recital linker to link multiple source program files into a single file that can then be compiled. This limits the number of files that need to be open at one time, thus using less Operating System file handles and making more efficient use of shared memory when running applications with SET PSHARE ON.

With SET PSHARE ON, compiled programs are loaded into shared memory when called. All users accessing a particular program can access the same area of shared memory rather than loading the program into private memory. The program is removed from shared memory when it no longer has any attached users. A single compiled program therefore, need only be loaded once and accessed by all users. Multiple smaller compiled programs cause an increased amount of loading and unloading activity in shared memory.


Keyword Description
<.dbl file> A text file containing a list of program files to link. These should be listed one to a line and must be unique. If no file extension is given, a .dbl extension is assumed.
<skeleton> A skeleton pattern for the program files to link. This must include the "*" as a wildcard, e.g. "app1*.prg" or "*.prg"
<.src file> The name of the output file to be created. If no file extension is specified, the file will be given a .src extension. By convention the .src extension is used to differentiate linked source files from individual .prg files. The output file will be created if it does not exist and overwritten if it does.
MESSAGE <.map file> The optional MESSAGE clause allows linker message output to be sent to the specified <.map file>. If no file extension is specified, the file will be given a .map extension. This text file will be created if it does not exist and overwritten if it does.
COMMAND <expC> If the optional COMMAND clause is specified, a 'do <expC>' line will be included in the output file as the first executable line. The <expC> should evaluate to the name of the first procedure to be run. The output file can then be called as a self-contained module rather than being used as a procedure library.
COMMENTS The optional COMMENTS keyword will leave comments and indentations in the output file. By default these are not included by the linker.


The Recital Linker can also be called from the Operating System command line:


$ recitaladmin -l -i <input file> -o <output file> -x <first procedure> -m <message file>

or

$ recitaladmin linker -i <input file> -o <output file> -x <first procedure> -m <message file>


Note: The earlier dbl syntax has been deprecated in Recital 10, to be replaced with recitaladmin -l | linker.


Example

// Creating linked file app1.src to include all files matching the "app1*.prg" skeleton.
// Message output will be written to output.map.
// First executable line will be 'do app1start'
// Comments and indentations will be retained
link from "app1*.prg" to app1 message output command "app1start" comments

Another example:

//app1.dbl
app1start.prg
app1main.prg
app1end.prg
//end of app1.dbl
// Creating linked file app1.src to include all files specified in app1.dbl.
// Message output will be written to info.map.
// First executable line will be 'do app1start'
// Comments and indentations will be stripped
link from app1 to app1 message info command "app1start"


Products

Recital Server, Recital