Table of Contents

   Welcome to FreeBASIC
   Getting Help with FreeBASIC

Language Documentation

   .
      ...

   _
      __DATE__
      __DATE_ISO__
      __FB_64BIT__
      __FB_ARG_COUNT__
      __FB_ARG_EXTRACT__
      __FB_ARG_LEFTOF__
      __FB_ARG_RIGHTOF__
      __FB_ARGC__
      __FB_ARGV__
      __FB_ARM__
      __FB_ASM__
      __FB_BACKEND__
      __FB_BIGENDIAN__
      __FB_BUILD_DATE__
      __FB_BUILD_DATE_ISO__
      __FB_BUILD_SHA1__
      __FB_CYGWIN__
      __FB_DARWIN__
      __FB_DEBUG__
      __FB_DOS__
      __FB_ERR__
      __FB_EVAL__
      __FB_FPMODE__
      __FB_FPU__
      __FB_FREEBSD__
      __FB_GCC__
      __FB_GUI__
      __FB_IIF__
      __FB_JOIN__
      __FB_LANG__
      __FB_LINUX__
      __FB_MAIN__
      __FB_MIN_VERSION__
      __FB_MT__
      __FB_NETBSD__
      __FB_OPENBSD__
      __FB_OPTIMIZE__
      __FB_OPTION_BYVAL__
      __FB_OPTION_DYNAMIC__
      __FB_OPTION_ESCAPE__
      __FB_OPTION_EXPLICIT__
      __FB_OPTION_GOSUB__
      __FB_OPTION_PRIVATE__
      __FB_OUT_DLL__
      __FB_OUT_EXE__
      __FB_OUT_LIB__
      __FB_OUT_OBJ__
      __FB_PCOS__
      __FB_PPC__
      __Fb_Query_Symbol__
      __FB_QUOTE__
      __FB_SIGNATURE__
      __FB_SSE__
      __FB_UNIQUEID__
      __FB_UNIQUEID_POP__
      __FB_UNIQUEID_PUSH__
      __FB_UNIX__
      __FB_UNQUOTE__
      __FB_VECTORIZE__
      __FB_VER_MAJOR__
      __FB_VER_MINOR__
      __FB_VER_PATCH__
      __FB_VERSION__
      __FB_WIN32__
      __FB_X86__
      __FB_XBOX__
      __FILE__
      __FILE_NQ__
      __FUNCTION__
      __FUNCTION_NQ__
      __LINE__
      __PATH__
      __TIME__

   #
      #assert
      #Cmdline
      #define
      #else
      #elseif
      #endif
      #endmacro
      #error
      #if
      #ifdef
      #ifndef
      #inclib
      #include
      #lang
      #libpath
      #line
      #macro
      #pragma
      #Pragma Reserve
      #print
      #undef

   $
      $Dynamic
      $Include
      $Lang
      $Static

   ?
      ? (Shortcut For 'Print')
      ? # (Shortcut For 'Print #')
      ? Using (Shortcut For 'Print Using')

   A
      Abs
      Abstract (Member)
      Access
      Acos
      Add (Graphics Put)
      Alias (Name)
      Alias (Modifier)
      Allocate
      Alpha (Graphics Put)
      And
      AndAlso
      And (Graphics Put)
      Any
      Append
      Arraylen
      Arraysize
      As
      Asc
      Asin
      Asm
      Assert
      AssertWarn
      Atan2
      Atn

   B
      Base (Initialization)
      Base (Member Access)
      Beep
      Bin
      Binary
      Bit
      BitReset
      BitSet
      BLoad
      Boolean
      BSave
      Byref (Parameters)
      Byref (Function Results)
      Byref (Variables)
      Byte
      ByVal

   C
      Call
      CAllocate
      Case
      Cast
      CBool
      CByte
      CDbl
      cdecl
      Chain
      ChDir
      Chr
      CInt
      Circle
      Class
      Clear
      CLng
      CLngInt
      Close
      Cls
      Color
      Command
      Common
      CondBroadcast
      CondCreate
      CondDestroy
      CondSignal
      CondWait
      Const
      Const (Member)
      Const (Qualifier)
      Constructor
      Constructor (Module)
      Continue
      Cos
      CPtr
      CShort
      CSign
      CSng
      CsrLin
      CUByte
      CUInt
      CULng
      CULngInt
      CUnsg
      CurDir
      CUShort
      Custom (Graphics Put)
      Cva_Arg
      Cva_Copy
      Cva_End
      Cva_List
      Cva_Start
      CVD
      CVI
      CVL
      CVLongInt
      CVS
      CVShort

   D
      Data
      Date
      DateAdd
      DateDiff
      DatePart
      DateSerial
      DateValue
      Day
      Deallocate
      Declare
      DefByte
      DefDbl
      defined
      DefInt
      DefLng
      DefLongInt
      DefShort
      DefSng
      DefStr
      DefUByte
      DefUInt
      Defulongint
      DefUShort
      Delete (Statement)
      Destructor
      Destructor (Module)
      Dim
      Dir
      Do
      Do...Loop
      Double
      Draw
      Draw String
      DyLibFree
      DyLibLoad
      DyLibSymbol

   E
      Else
      ElseIf
      Encoding
      End (Block)
      End (Statement)
      End If
      Enum
      Environ Statement
      Environ
      EOF
      Eqv
      Erase
      Erfn
      Erl
      Ermn
      Err
      Error
      Event (Message Data From Screenevent)
      Exec
      ExePath
      Exit
      Exp
      Export
      Extends
      Extends Wstring
      Extends Zstring
      Extern
      Extern...End Extern

   F
      False
      Fastcall
      Fb_Memcopy
      fb_MemCopyClear
      Fb_Memmove
      Fbarray (Array Descriptor Structure And Access)
      Field
      FileAttr
      FileCopy
      FileDateTime
      FileExists
      FileFlush
      FileLen
      FileSetEof
      Fix
      Flip
      For
      For...Next
      Format
      Frac
      Fre
      FreeFile
      Function
      Function (Member)
      Function (Pointer)

   G
      Get (Graphics)
      Get # (File I/O)
      GetJoystick
      GetKey
      GetMouse
      GoSub
      Goto

   H
      Hex
      HiByte
      HiWord
      Hour

   I
      If...Then
      IIf
      ImageConvertRow
      ImageCreate
      ImageDestroy
      ImageInfo
      Imp
      Implements
      Import
      Inkey
      Inp
      Input (Statement)
      Input (File I/O)
      Input #
      Input()
      InStr
      InStrRev
      Int
      Integer
      Is (Select Case)
      Is (Run-Time Type Information Operator)
      IsDate
      IsRedirected

   K
      Kill

   L
      LBound
      LCase
      Left
      Len
      Let
      Lib
      Line
      Line Input
      Line Input #
      LoByte
      LOC
      Local
      Locate
      Lock
      LOF
      Log
      Long
      LongInt
      Loop
      LoWord
      LPos
      LPrint
      LSet
      LTrim

   M
      Mid (Statement)
      Mid (Function)
      Minute
      MKD
      MkDir
      MKI
      MKL
      MKLongInt
      MKS
      MKShort
      Mod
      Month
      MonthName
      MultiKey
      MutexCreate
      MutexDestroy
      MutexLock
      MutexUnlock

   N
      Naked
      Name
      Namespace
      New (Expression)
      New (Placement)
      Next
      Next (Resume)
      Not
      Now

   O
      Object
      Oct
      OffsetOf
      On Error
      On...Gosub
      On...Goto
      Once
      Open
      Open Com
      Open Cons
      Open Err
      Open Lpt
      Open Pipe
      Open Scrn
      Operator
      Option()
      Option Base
      Option ByVal
      Option Dynamic
      Option Escape
      Option Explicit
      Option Gosub
      Option Nogosub
      Option NoKeyword
      Option Private
      Option Static
      Or
      Or (Graphics Put)
      OrElse
      Out
      Output
      Overload
      Override

   P
      Paint
      Palette
      pascal
      PCopy
      Peek
      PMap
      Point
      PointCoord
      Pointer
      Poke
      Pos
      Preserve
      PReset
      Print
      Print #
      Print Using
      Private
      Private: (Access Control)
      ProcPtr
      Property
      Protected: (Access Control)
      Pset (Statement)
      Pset (Graphics Put)
      Ptr (Shortcut For 'Pointer')
      Public
      Public: (Access Control)
      Put (Graphics)
      Put # (File I/O)

   R
      Random
      Randomize
      Read
      Read (File Access)
      Read Write (File Access)
      Reallocate
      ReDim
      Rem
      Reset
      Restore
      Resume
      Resume Next
      Return (From Procedure)
      Return (From Gosub)
      RGB
      RGBA
      Right
      RmDir
      Rnd
      RSet
      RTrim
      Run

   S
      SAdd
      Scope
      Screen
      Screen (Console)
      ScreenCopy
      ScreenControl
      ScreenEvent
      ScreenGLProc
      ScreenInfo
      ScreenList
      ScreenLock
      ScreenPtr
      ScreenRes
      ScreenSet
      ScreenSync
      ScreenUnlock
      Second
      Seek (Statement)
      Seek (Function)
      Select Case
      SetDate
      SetEnviron
      SetMouse
      SetTime
      Sgn
      Shared
      Shell
      Shl
      Short
      Shr
      Sin
      Single
      SizeOf
      Sleep
      Space
      Spc
      Sqr
      Static
      Static (Member)
      stdcall
      Step
      Stick
      Stop
      Str
      Strig
      String (Function)
      String
      StrPtr
      Sub
      Sub (Member)
      Sub (Pointer)
      Swap
      System

   T
      Tab
      Tan
      Then
      This
      Thiscall
      ThreadCall
      ThreadCreate
      ThreadDetach
      ThreadSelf
      ThreadWait
      Time
      Timer
      TimeSerial
      TimeValue
      To
      Trans (Graphics Put)
      Trim
      True
      Type (Alias)
      Type (Temporary)
      Type (Udt)
      TypeOf

   U
      UBound
      UByte
      UCase
      UInteger
      ULong
      ULongInt
      Union
      Unlock
      Unsigned
      Until
      UShort
      Using (Print)
      Using (Namespaces)

   V
      va_arg
      va_first
      va_next
      Val
      ValLng
      ValInt
      ValUInt
      ValULng
      Var
      VarPtr
      View Print
      View (Graphics)
      Virtual (Member)

   W
      Wait
      WBin
      WChr
      Weekday
      WeekdayName
      Wend
      While
      While...Wend
      WHex
      Width
      Window
      WindowTitle
      WInput
      With
      WOct
      Write
      Write #
      Write (File Access)
      WSpace
      WStr
      Wstring (Data Type)
      Wstring (Function)

   X
      Xor
      Xor (Graphics Put)

   Y
      Year

   Z
      ZString
   Operator List

   Variables and Data Types
      Variable Declarations
      User Defined Types
      Standard Data Types
      Standard Data Type Limits
      Converting Between Data Types

   Assignment operators
      Operator =[>] (Assignment)
      Operator &= (Concatenate And Assign)
      Operator += (Add And Assign)
      Operator -= (Subtract And Assign)
      Operator *= (Multiply And Assign)
      Operator /= (Divide And Assign)
      Operator \= (Integer Divide And Assign)
      Operator ^= (Exponentiate And Assign)
      Operator Let (Assignment)
      Operator Let() (Assignment)
      Operator Mod= (Modulus And Assign)
      Operator And= (Conjunction And Assign)
      Operator Eqv= (Equivalence And Assign)
      Operator Imp= (Implication And Assign)
      Operator Or= (Inclusive Disjunction And Assign)
      Operator Xor= (Exclusive Disjunction And Assign)
      Operator Shl= (Shift Left And Assign)
      Operator Shr= (Shift Right And Assign)

   Arithmetic operators
      Operator + (Add)
      Operator - (Subtract)
      Operator * (Multiply)
      Operator / (Divide)
      Operator \ (Integer Divide)
      Operator ^ (Exponentiate)
      Operator Mod (Modulus)
      Operator - (Negate)
      Operator Shl (Shift Left)
      Operator Shr (Shift Right)

   Conditional operators
      Operator = (Equal)
      Operator <> (Not Equal)
      Operator < (Less Than)
      Operator <= (Less Than Or Equal)
      Operator >= (Greater Than Or Equal)
      Operator > (Greater Than)
      Operator Is (Run-Time Type Information)

   Logical operators
      Operator And (Conjunction)
      Operator Eqv (Equivalence)
      Operator Imp (Implication)
      Operator Not (Complement)
      Operator Or (Inclusive Disjunction)
      Operator Xor (Exclusive Disjunction)

   Short circuit operators
      Operator Andalso (Short Circuit Conjunction)
      Operator Orelse (Short Circuit Inclusive Disjunction)

   Indexing operators
      Operator () (Array Index)
      Operator [] (String Index)
      Operator [] (Pointer Index)

   String operators
      Operator + (String Concatenation)
      Operator & (String Concatenation With Conversion)
      Operator Strptr (String Pointer)

   Preprocessor operators
      Operator # (Stringize)
      Operator ## (Concatenation)
      Operator ! (Escaped String Literal)
      Operator $ (Non-Escaped String Literal)

   Pointer operators
      Operator Varptr (Variable Pointer)
      Operator Strptr (String Pointer)
      Operator Procptr (Procedure Pointer And Vtable Index)
      Operator @ (Address Of)
      Operator * (Value Of)

   Type or Class operators
      Operator . (Member Access)
      Operator -> (Pointer To Member Access)
      Operator Is (Run-Time Type Information)

   Memory operators
      Operator New Expression
      Operator New Overload
      Operator Placement New
      Operator Delete Statement
      Operator Delete Overload

   Iterating operators
      Operator For
      Operator Step
      Operator Next
      Operator Precedence
      Bitwise Operators & Truth Tables

   Statements
      Control Flow
      Procedures
      Modularizing

   Other
      Preprocessor
      Escape Sequences In String Literals
      Meta-statements
      Intrinsic Defines
      Error Handling
      Inline Asm

Runtime Library Reference
   Array Functions
   Bit Manipulation
   Console Functions
   Date and Time Functions
   Error Handling Functions
   File IO Functions
   Mathematical Functions
   Memory Functions
   Operating System Functions
   String Functions
   Threading Support Functions
   User Input Functions

Graphics Library Reference
   2D Drawing Functions
   User Input Functions
   Screen Functions
   Supported graphics drivers (backends)
   Keyboard Scan Codes
   Default Palettes

Tutorials

   Getting Started
      Hello World
      FreeBASIC Primer #1

   Source Files
      Source Files (.bas)
      Header Files (.bi)
      Using Prebuilt Libraries
      Manage Reusable Procedures by Including Source vs Compiled Modules

   Lexical Conventions
      Comments
      Identifier Rules
      Literals
      Labels
      Line Continuation
      Line Separator

   Variables and Datatypes
      Constants and Enumerations
      Numeric Types
      Strings (string, zstring, and wstring)
      Coercion and Conversion
      Constants
      Variables

      Arrays
         Overview
         Fixed-length Arrays
         Variable-length Arrays
         Array Indexing
         Passing Arrays to Procedures

      Pointers
         Overview
         Pointer Arithmetic

      References
         From Pointers to References
         Using References

   Declarations
      Implicit Declarations
      Initialization
      Storage Classes
      Variable Scope
      Simple Variable Lifetime vs Scope
      Dynamic Object and Data Lifetime
      Namespaces
      Variable and Procedure Linkage

   User Defined Types
      Overview
      Type Aliases
      Temporary Types
      Type (UDT/Alias/Temporary) and Union
      Constructors and Destructors (basics)
      Member Procedures
      Properties
      Variable-length member data
      Member Access Rights and Encapsulation
      Operator Overloading
      Iterators
      New and Delete
      Types as Objects
      Composition, Aggregation, Inheritance
      Inheritance Polymorphism
      Constructors, '=' Assignment-Operators, and Destructors (advanced, part #1)
      Constructors, '=' Assignment-Operators, and Destructors (advanced, part #2)

   Statements and Expressions
      Differences between Expressions and Statements
      Constant Expressions
      Assignments
      Operator Precedence
      Control Flow Statements

   Procedures
      Procedures Overview
      Passing Arguments to Procedures
      Returning a Value
      Procedure Scopes
      Calling Conventions
      Recursion
      Callback
      Constructors and Destructors
      Pointers to Procedures
      Variadic Arguments

   Graphics
      FreeBASIC GfxLib overview
      Graphics Mode Refresh and Anti-Flickering
      Internal Graphics Formats
      External Graphics File Formats

   Multi-Threading
      Overview
      Threads
      Mutual Exclusion
      Conditional Variables
      Critical Sections
      Critical Sections FAQ

   Making Binaries
      Executables
      Static Libraries
      Shared Libraries (DLLs)
      Profiling

   Preprocessor
      Overview
      Conditional Compilation
      Macros

   Other Topics
      ASCII
      Date Serials
      Radians
      Error Handling
      Event Handling
      Intrinsic Defines
      Identifier Look-ups in namespaces and types

   Technical Articles
      Inline Asm
      C Standard Library Functions
      File I/O with FreeBASIC
      Dynamic memory management with FreeBASIC
      Replace Recursion with Iteration
      OBJECT built-in and RTTI info
      Embed and Access binary Data in Executable
      Use Implicit / Overload New([]) and Delete([]) Operators with Inheritance Polymorphism
      Emulate a TLS (Thread Local Storage) and a TP (Thread Pooling) feature

   Community Tutorials

   Community Code Library

External Libraries Index

   Graphical/test-based user interfaces
      CGUI
      Curses
      GTK+
      IUP
      wxC
      Windows API
      X11

   Graphics
      Allegro
      DUGL
      caca
      Cairo
      DISLIN
      freeglut
      FreeImage
      Freetype2
      GD
      GIFLIB
      GLUT
      GLFW
      GRX
      IL (DevIL)
      japi
      jpeglib
      JPGalleg
      libpng
      OpenGL
      PDFlib
      SDL
      TinyPTC

   Music/Sound, Audio/Video
      BASS
      BASSMOD
      Flite
      FMOD
      MediaInfo
      mpg123
      Ogg
      OpenAL
      PortAudio
      sfx
      sndfile
      VLC
      Vorbis

   Database
      GDBM
      MySQL
      PostgreSQL
      SQLite

   Development Helpers
      CUnit
      GDSL
      gettext (includes libintl)
      GNU ASpell
      libbfd

   Embeddable Languages
      JNI
      json-c
      libffi
      libjit
      Lua
      SpiderMonkey

   Cryptography
      cryptlib
      UUID

   Mathematics
      big_int
      Chipmunk
      GMP
      GSL
      Newton
      ODE

   Networking
      cgi-util
      curl
      FastCGI
      ZeroMQ

   eXtensible Markup Language (XML)
      Expat
      libxml
      libxslt
      Mini-XML

   Regular Expressions
      PCRE
      TRE

   Compression
      bzip2
      libzip
      liblzma
      LZO
      QuickLZ
      zlib

   System APIs
      C Runtime Library
      DOS API
      disphelper
      GLib
      Windows API
      X11

Using the FreeBASIC compiler
   Installing FreeBASIC
   Requirements
   Running FreeBASIC
   Using the Command Line

   Command Line Options
      @< file >
      -a < name >
      -arch < type >
      -asm < format >
      -b < name >
      -buildprefix
      -c
      -C
      -d < name=val >
      -dll
      -dylib
      -e
      -earray
      -eassert
      -edebug
      -edebuginfo
      -elocation
      -entry < name >
      -enullptr
      -eunwind
      -ex
      -exx
      -export
      -forcelang <name>
      -fpmode < type >
      -fpu < type >
      -g
      -gen < backend >
      -i < name >
      -include < name >
      -l < name >
      -lang < name >
      -lib
      -m < name >
      -map < name >
      -maxerr < val >
      -mt
      -nodeflibs
      -nolib < name(s) >
      -noerrline
      -noobjinfo
      -nostrip
      -o < name >
      -O < level >
      -p < name >
      -pic
      -pp
      -prefix < path >
      -print < option >
      -profile
      -r
      -R
      -rr
      -RR
      -s < name >
      -showincludes
      -static
      -strip
      -t < value >
      -target < platform >
      -v
      -vec < level >
      -version
      -w < value >
      -Wa < opt >
      -Wc < opt >
      -Wl < opt >
      -x < name >
      -z < value >
   Debugging with FreeBASIC
   Compiler Error Messages
   Tools used by fbc
   Installing gcc for -gen gcc

FreeBASIC dialects and QBASIC
   FreeBASIC and Qbasic
   Differences from QB
   FreeBASIC Dialects

FAQs
   Compiler FAQ
   Graphics Library FAQ
   Runtime Library FAQ
   Xbox port FAQ
   DOS related FAQ
   Windows related FAQ
   Linux related FAQ

Miscellaneous
   Obsolete Keywords
   Glossary
   Miscellaneous Keywords
   C Standard Library Functions
   ASCII Character Codes
   Runtime Error Codes
   C/C++ vs. FreeBASIC syntax comparison
   C/C++ vs. FreeBASIC integer data type comparison

Hacking on FreeBASIC
   Developer's Table of Contents