Understand the QB64-PE auto-include logic
mainSince v4.0.0, QB64-PE automatically includes support files (such as general/color constants and $DEBUG vwatch code) at specific positions in your program. Since v4.3.0, this mechanism also handles the $USELIBRARY metacommand to manage 3rd party library dependencies.
This process is transparent to the user, but understanding the three primary include positions helps in managing program structure and library dependencies:
- AtTop: Occurs before the first line of user code. Used for initializing
CONST,(RE)DIM [SHARED], andTYPE. Files typically use the*.biextension. - AfterMain: Occurs at the end of the main level code. Traditionally used for
DATA,GOSUBroutines, or error handlers. Since v4.4.0, this position always occurs right before the AtBottom includes, even if main-level andSUB/FUNCTIONcode are interleaved. - AtBottom: Occurs after the last line of user code. Used for
SUBandFUNCTIONdefinitions. Files typically use the*.bmextension.