Skip to content

LIBRARY

Brain edited this page May 9, 2023 · 4 revisions

LIBRARY

LIBRARY string-expression

Load a library into the program. A library is a set of BASIC procedures and functions (PROC/FN) in a separate file which must not contain line numbers. Immediately after the LIBRARY statement, any procedures or functions in that library will be immediately available.

As it is recommended that BASIC programs load libraries from the standard GLOBAL LIB$ directory, as in the example below:

LIBRARY LIB$ + "/ansi"

LIB$ is a global variable passed from init which contains an absolute path to a library folder. You can of course ignore this to load locally sourced dependencies if you wish.

If programs which are line-numbered load a library, the library will be auto-numbered with its numbers being after any numbers already in the BASIC program, using increments of 10.

It is recommended to place LIBRARY statements at or near the start of your program as loading a library is a somewhat expensive operation.

When a library is loaded, Retro Rocket will look for a PROC with the same name as the filename of the library, and call it if it exists. This "constructor" procedure can be used to transparently initialise the state of the library when it is loaded.
Clone this wiki locally