PowerBASIC Language Reference
Note: PBXA64 is a prototype. Only the documented subset of PowerBASIC is supported. Full PBWin/PBCC compatibility is not yet achieved.
Module Structure
#COMPILE EXE "output.exe"
#DIM ALL
' Declarations
DECLARE FUNCTION MsgBox LIB "user32.dll" ALIAS "MessageBoxA" (...)
GLOBAL g_count AS LONG
' Types
TYPE Point2D
x AS DOUBLE
y AS DOUBLE
END TYPE
' Main entry
FUNCTION PBMAIN() AS LONG
LOCAL name AS STRING
name = "PBXA64"
PRINT "Hello, "; name
FUNCTION = 0
END FUNCTION
Supported Features (V22)
| Category | Supported | Limitations |
|---|---|---|
| Program entry | FUNCTION PBMAIN() AS LONG | Required entry point |
| Procedures | FUNCTION, SUB, DECLARE, CALLBACK | Full WinAPI support |
| Variables | LOCAL, DIM, STATIC, GLOBAL | GLOBAL (limited), no THREADED |
| Types | INTEGER, LONG, QUAD, BYTE, WORD, DWORD, SINGLE, DOUBLE, STRING | No VARIANT, OBJECT, GUID |
| Arrays | Fixed arrays, stack-backed REDIM | No REDIM PRESERVE, no heap arrays |
| Strings | Local ASCIIZ buffers, concat (+), LEN, STRPTR, VARPTR | Fixed-length only, no dynamic |
| Control flow | IF/ELSE/END IF, FOR/NEXT, WHILE/WEND, SELECT CASE, DO/LOOP, GOTO, GOSUB | Fully supported |
| I/O | PRINT, OPEN/PRINT#/INPUT#/CLOSE, LINE INPUT#, GET/PUT, BINARY | Fully supported via WinAPI |
| Macros | MACRO, MACROFUNCTION, MACROTEMP, #DEFINE | Full V22 expansion engine |
| External calls | WinAPI DECLARE with >4 args | Varargs, struct args supported |