Jump to navigation Jump to search
Revision as of 15:18, 19 July 2012 by
$INCLUDE is a metacommand that is used to insert a source code file into your program which is then executed at the point of the insertion.
- $INCLUDE is often used to add functions and subs from an external text library.
- There must always be a REM or ' comment before the $INCLUDE metacommand.
- The source file MUST have REM or apostrophies around the name.
- The source file included can contain any BASIC statement except GOTO
- QB 4.5 can use DECLARE SUB in BI files such as QB.BI. QB64 ignores Qbasic's DECLARE statements.
- QB64 users can use all statements in their include files. See below.
- The $INCLUDE metacommand should be the only statement on a line since execution progresses after the code line.
- 1) Assemble your text code into a TEXT file and name it something with a .BI or .BM file name extension. NOT as .TXT!
- 2) $INCLUDE any DEFINT, DIM, CONST, SHARED arrays or DATA at the very beginning of the main program code.
- 3) $INCLUDE SUBs or FUNCTIONs at the very bottom of the main program code AFTER any SUB procedures.
- 4) Compile the program with the included text files in the QB64 folder! Save the text files to use them like Library files.
Example: '$INCLUDE: 'QB.BI'
See Library Examples:
- SelectScreen (member $INCLUDE demo)
- FILELIST$ (function) (member FILE Search function)
- SAVEIMAGE (SUB program that creates bitmaps)