Library (statement)

From BR Wiki
Revision as of 16:44, 16 December 2013 by John (talk | contribs)
Jump to navigation Jump to search

The Library statement is used in conjuction with the Library Facility to allow one program to access and use User Defined Functions from other programs.

Comments and Examples

To use the LIBRARY statement, first the function must be defined in a program and then identified. To qualify as a library function, a user-defined function must simply utilize the DEF statement's LIBRARY keyword. The following is an example of a library function definition:

52400 DEF LIBRARY FNPRESLIB2
52500 PRINT "This is a library function"
52600 FNEND

Executing a library function is a two-step process. First, the program executing the library function must name the function in a LIBRARY statement, which establishes either named or unnamed linkage. Second, the program must call the library function; this may be accomplished using any of the same methods that is available for calling other user-defined functions. In the following example, line 01000 uses the LIBRARY statement to establish named linkage between the function FNPRESLIB2 and the library PRESLIB. Line 01100 causes the library PRESLIB to be loaded into present memory (if the library does not already exist in memory), then executes FNPRESLIB2.

01000 LIBRARY "PRESLIB": FNPRESLIB2
01100 LET FNPRESLIB2

Syntax

Parameters

The "Library Name" refers to the program, or library, where the library function has been defined. It must be enclosed in quotation marks.

Following a colon, the Function Name is simply the name of the function to be used.

See also the NoFiles parameter.

See Also