GFA-BASIC 32 $Libraries


Modular programming

Libraries are compiled GFA-BASIC 32 code units and are comparible to Visual Basic modules. Libraries can also be compared to units in Pascal. Libraries can contain every language element and are programmed exactly like normal GFA-BASIC 32 programs. There is one major difference: without exporting library elements you have no access to the libray code unit from outside. To gain access of the library elements in the program that imports the lg32 library, these elements must be exported explicitly using the $Export directive.

Compiled code unit

A library is always a compiled GFA-BASIC 32 project and stored with the default extension 'lg32', for easy differentiation from 'g32' code files, 'gll' extensions, and 'EXE' stand-alone files. Using the default extension also allows for reference without using the lg32 extension lateron. As the library is a GFA-BASIC 32 project you can develop it as a single program. Often, the target of the library is to export subroutines to be called from the program it is imported in, but by inserting test code the libray can be easily developed as a stand-alone project (using full debugger support).

 A library can be saved into the directory where its source code is stored as well. This works particulary well for libraries containing code moved from the main project file to a library module. On the other hand, libraries solely used for including constants, types, and declarations should be best stored in one location, for instance a directory called 'include'.

This section copes with libraries, please choose one of the following

 Loading Libraries (lg32)

 Editor Extension functions are not allowed in a lg32.