Difference between revisions of "$INCLUDE"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
m
imported>Clippy
m
Line 9: Line 9:
 
* The source file included can contain any BASIC statement except [[SUB]] or [[GOTO]]  
 
* The source file included can contain any BASIC statement except [[SUB]] or [[GOTO]]  
 
* QB 4.5 can use SUB calls in BI files such as [[QB.BI]].  
 
* QB 4.5 can use SUB calls in BI files such as [[QB.BI]].  
* '''QB64 users can use all statements in their include files.'''
+
* '''QB64 users can use all statements in their include files.''' The $INCLUDE of a SUB or a  Function should be after after your main program! Otherwise you will get the '''QB64''' compiler error "Statement cannot be placed between SUB/FUNCTIONs"
 
* The $INCLUDE metacommand should be the only statement on a line since execution progresses ''after'' the line of the metacommand.
 
* The $INCLUDE metacommand should be the only statement on a line since execution progresses ''after'' the line of the metacommand.
 
* $INCLUDE is often used to [[DECLARE]] functions and subs used in an external library.
 
* $INCLUDE is often used to [[DECLARE]] functions and subs used in an external library.

Revision as of 00:10, 2 August 2010

$INCLUDE is a metacommand that is used to insert a source file into your program which is then executed at the point of the insertion.


Syntax: {REM | ' } $INCLUDE: 'sourcefile'


  • 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 SUB or GOTO
  • QB 4.5 can use SUB calls in BI files such as QB.BI.
  • QB64 users can use all statements in their include files. The $INCLUDE of a SUB or a Function should be after after your main program! Otherwise you will get the QB64 compiler error "Statement cannot be placed between SUB/FUNCTIONs"
  • The $INCLUDE metacommand should be the only statement on a line since execution progresses after the line of the metacommand.
  • $INCLUDE is often used to DECLARE functions and subs used in an external library.


Example: ' $INCLUDE: 'QB.BI'



See Examples:

SelectScreen (member $INCLUDE demo)

_FILE$ (function) (member FILES function)


See also:

INTERRUPT

INTERRUPTX

Metacommand




Navigation:
Keyword Reference - Alphabetical
Keyword Reference - By Usage
Main Wiki Page