#INCLUDE "filename"#INCLUDE ONCE "filename"
The #INCLUDE directive inserts the contents of another source file at the point where the directive appears. This is the primary mechanism for modular code organization, API declarations, and type sharing in PBXA64.
The included file is treated as if its content were physically pasted into the including file at the exact location of the #INCLUDE line. Included files typically use the .inc extension but any text file is accepted.
The optional ONCE keyword prevents the file from being included more than once in a single compilation unit, guarding against duplicate declarations. This is equivalent to C's #pragma once.
| Parameter | Description |
|---|---|
ONCE | Optional keyword. Ensures the file is included only once per compilation, even if #INCLUDE for this file appears in multiple locations (e.g., through nested includes). |
"filename" | The path and filename of the file to include, enclosed in double quotes. Relative paths are resolved against the directory containing the current source file. Absolute paths are also accepted. |
' Include Windows API declarations (once)
#INCLUDE ONCE "Win32API.inc"
' Include project constants
#INCLUDE "MyProject_Constants.inc"
' Include utility functions
#INCLUDE "MyUtils.inc"
FUNCTION PBMAIN() AS LONG
LOCAL hWnd AS DWORD
hWnd = GetConsoleWindow()
PRINT "Console handle: "; hWnd
FUNCTION = 0
END FUNCTION
#INCLUDE ONCE for header-style files that declare types, constants, and API functions to prevent redefinition errors.<file>). Always use double quotes.#RESOURCE directive; use #INCLUDE with resource script files if needed.