# The Gambas Programming Interface

To use the Gambas Programming Interface, a C/C++ module must include the `gambas.h` file at its beginning.

- Constants
  - Datatypes identifiers
  - Hook identifiers
  - Number conversion constants
  - Predefined errors
  - String comparison constants
  - Watch constants
- Types & structures
  - Callbacks datatypes
  - Class description
  - Date management
  - Gambas datatypes
  - Gambas values datatypes
  - Object datatypes
- Macros
  - Arguments handling
  - Class description
  - Declaring events, methods and properties
  - Methods implementation
  - Properties implementation
- Functions
  - Array objects
  - Collection objects
  - Collection of sub-objects
  - Component management
  - Date & Time management
  - Error management
  - Events handling
  - File management
  - Function calling
  - Memory allocations
  - Methods and properties
  - Native arrays
  - Native hash tables
  - Objects and classes
  - Posted routines
  - Returning a value
  - Storing values in memory
  - String management
  - String conversion
  - String routines replacement
  - System information
  - Watching file descriptors

## Constants

### Datatypes identifiers

- GB_T_VOID
- GB_T_BOOLEAN
- GB_T_BYTE
- GB_T_SHORT
- GB_T_INTEGER
- GB_T_LONG
- GB_T_FLOAT
- GB_T_DATE
- GB_T_STRING
- GB_T_CSTRING
- GB_T_VARIANT
- GB_T_NULL
- GB_T_OBJECT

### Hook identifiers

- GB_HOOK_MAIN
- GB_HOOK_LOOP
- GB_HOOK_WAIT
- GB_HOOK_MESSAGE
- GB_HOOK_WATCH
- GB_HOOK_POST
- GB_HOOK_QUIT
- GB_HOOK_ERROR

### Number conversion constants

- GB_NB_READ_INTEGER
- GB_NB_READ_FLOAT
- GB_NB_READ_BOTH
- GB_NB_READ_HEX_BIN
- GB_NB_LOCAL

### Predefined errors

- GB_ERR_ARG

### String comparison constants

- GB_COMP_BINARY
- GB_COMP_TEXT

### Watch constants

- GB_WATCH_NONE
- GB_WATCH_READ
- GB_WATCH_WRITE
- GB_WATCH_READ_WRITE

## Types & structures

### Callbacks datatypes

- GB_WATCH_CALLBACK
- GB_SUBST_CALLBACK
- GB_HASHTABLE_ENUM_FUNC

### Class description

- GB_DESC

### Date management

- GB_DATE_SERIAL

### Gambas datatypes

- GB_BASE
- GB_CLASS
- GB_TYPE
- GB_HASHTABLE
- GB_STREAM
- GB_STREAM_DESC
- GB_FUNCTION

### Gambas values datatypes

- GB_VALUE
- GB_BOOLEAN
- GB_INTEGER
- GB_FLOAT
- GB_DATE
- GB_STRING
- GB_VARIANT
- GB_OBJECT

### Object datatypes

- GB_ARRAY
- GB_COLLECTION
- GB_SUBCOLLECTION
- GB_SUBCOLLECTION_DESC

## Macros

### Arguments handling

- ARG
- MISSING
- VALUE
- VARG
- STRING
- LENGTH
- VARGOPT

### Class description

- GB_DECLARE
- GB_END_DECLARE
- GB_VIRTUAL_CLASS
- GB_NOT_CREATABLE
- GB_AUTO_CREATABLE
- GB_INHERITS
- GB_CONSTANT
- GB_PROPERTY
- GB_STATIC_PROPERTY
- GB_PROPERTY_READ
- GB_STATIC_PROPERTY_READ
- GB_PROPERTY_SELF
- GB_STATIC_PROPERTY_SELF
- GB_METHOD
- GB_STATIC_METHOD
- GB_EVENT

### Declaring events, methods and properties

- DECLARE_EVENT
- DECLARE_METHOD
- DECLARE_PROPERTY

### Methods implementation

- BEGIN_METHOD
- BEGIN_METHOD_VOID
- END_METHOD

### Properties implementation

- BEGIN_PROPERTY
- END_PROPERTY
- READ_PROPERTY
- PROP
- VPROP

## Functions

### Array objects

- GB.Array.New
- GB.Array.Count
- GB.Array.Add
- GB.Array.Get

### Collection objects

- GB.Collection.New
- GB.Collection.Count
- GB.Collection.Set
- GB.Collection.Get

### Collection of sub-objects

- GB.SubCollection.New
- GB.SubCollection.Add
- GB.SubCollection.Remove
- GB.SubCollection.Get
- GB.SubCollection.Container

### Component management

- GB.GetInterface
- GB.Hook
- GB.LoadComponent

### Date & Time management

- GB.SplitDate
- GB.MakeDate
- GB.MakeDateFromTime
- GB.GetTime

### Error management

- GB.Error
- GB.Propagate

### Events handling

- GB.CanRaise
- GB.GetEvent
- GB.Raise

### File management

- GB.FileName
- GB.LoadFile
- GB.ReleaseFile
- GB.ExistFile
- GB.GetTempDir

### Function calling

- GB.Push
- GB.GetFunction
- GB.Call

### Memory allocations

- GB.Alloc
- GB.Free
- GB.Realloc

### Methods and properties

- GB.GetUnknown
- GB.IsProperty
- GB.NParam
- GB.GetEnum
- GB.StopEnum
- GB.Conv

### Native arrays

- GB.NewArray
- GB.FreeArray
- GB.Count
- GB.Add

### Native hash tables

- GB.HashTable.New
- GB.HashTable.Free
- GB.HashTable.Count
- GB.HashTable.Add
- GB.HashTable.Remove
- GB.HashTable.Get
- GB.HashTable.Enum

### Objects and classes

- GB.GetClass
- GB.GetClassName
- GB.FindClass
- GB.Is
- GB.Ref
- GB.Unref
- GB.UnrefKeep
- GB.Attach
- GB.Detach
- GB.New
- GB.CheckObject
- GB.AutoCreate

### Posted routines

- GB.Post
- GB.CheckPost

### Returning a value

- GB.ReturnInteger
- GB.ReturnBoolean
- GB.ReturnDate
- GB.ReturnObject
- GB.ReturnNull
- GB.ReturnFloat
- GB.ReturnPtr
- GB.ReturnString
- GB.ReturnConstString
- GB.ReturnConstZeroString
- GB.ReturnNewString
- GB.ReturnNewZeroString

### Storing values in memory

- GB.Store
- GB.StoreString
- GB.StoreObject
- GB.StoreVariant

### String management

- GB.NewString
- GB.FreeString
- GB.ExtendString
- GB.AddString
- GB.StringLength
- GB.ToZeroString
- GB.SubstString
- GB.SubstAdd

### String conversion

- GB.NumberFromString
- GB.NumberToString
- GB.ConvString

### String routines replacement

- GB.strcasecmp
- GB.strncasecmp
- GB.tolower
- GB.toupper

### System information

- GB.Application.Name
- GB.Application.Title
- GB.Application.Path
- GB.Application.Version
- GB.System.Charset

### Watching file descriptors

- GB.Watch