Gambas Documentation
Application Repository
Code Snippets
Compilation & Installation
Components
Controls pictures
Deprecated components
Developer Documentation
Development Environment Documentation
Documents
About The Best Formula In The World
Architecture details
Benchmarks
Books
By Reference Argument Passing
Compatibility between versions
Creating And Using Libraries
Database Datatype Mapping
Database Request Quoting
Date & time management
Dates and calendars
DBus and Gambas
Differences Between Shell And Exec
Differences From Visual Basic
Distributions & Operating Systems
Drag & Drop
DrawingArea Internal Behaviour
External functions datatype mapping
Frequently Asked Questions
Gambas Farm Server Protocol
Gambas Mailing List Netiquette
Gambas Markdown Syntax
Gambas Naming Conventions
Gambas Object Model
Gambas Scripting
Gambas Server Pages
Gambas Unit Testing
Gambas Wiki Markup Syntax
Getting Started With Gambas
Hall Of Fame
Housekeeping, cleaning up
Image Management In Gambas
Including Help Comments in Source Code
Interpreter limits
Introduction
Just In Time Compiler
Just In Time Compiler (old version)
License
Localisation and Internationalization
Mailing Lists & Forums
Naming Conventions
Network Programming
ODBC Component Documentation
PCRE Pattern Syntax
Porting from Gambas 2 to Gambas 3
Previous News
Project Directory Structure
Release Notes
Reporting a problem, a bug or a crash
Rich Text Syntax
Screenshots
Text highlighting definition file syntax
The Program has stopped unexpectedly by raising signal #11
Variable Naming Convention
WebPage Syntax
Web site home page
What Is Gambas?
Window & Form Management
Window Activation & Deactivation
Window Life Cycle
XML APIs
Error Messages
Gambas Playground
How To's
Language Index
Language Overviews
Last Changes
Lexicon
README
Search the wiki
To Do
Topics
Tutorials
Wiki License
Wiki Manual

Architecture details

Click on the picture to get details about Gambas architecture...

A drawing is better than a long speech. And I'm fond of this kind of diagram that make people think that program design is completely clean and careful thought ;-).

The Development Environment hides this machinery behind a pretty graphical interface.

Project

A project is a set of files stored in one directory.

A project can contain source files (forms, classes, modules) or any data files of any types:

  • The project configuration is stored in a file named ".project".

  • The source files are stored in a sub-directory named ".src".

  • Data files are stored in the project directory or in visible sub-directories.

Archiver

The Archiver is a program named gba3.

It transforms your project, the compiled files included, in one sole executable file.

Compiler

The Compiler is a program named gbc3.

It transforms your project's forms, classes and modules files into binary compiled files that can be understood and executed by the interpreter.

Executable Files

A Gambas executable file is an uncompressed archive of your project, the compiled files included.

The archive file is marked as a script with the #!/usr/bin/gbx3 magic header, so that Linux executes it by calling the interpreter transparently.

Compiled Files

A compiled file is a binary representation of a class, that contains every information useful to the interpreter : functions transformed to byte code, constants, variables definitions, debugging information, etc.

Using mmap System Call

If your project was compiled as an executable, i.e. as an archive, the interpreter maps the file into memory instead of loading it. It is worth doing !

Interpreter

The Interpreter is a program named gbx3.

It executes the byte code of the compiled file generated by the compiler.

Class Loader

The Class Loader loads compiled forms, classes and modules into the interpreter.

Execution Unit

The Execution Unit is the heart of the interpreter.

It dispatches and executes each byte-code instruction generated by the compiler.

Debugger

The Debugger is a command-line tool embedded in the interpreter.

It allows the development environment to debug a Gambas program by running it step by step, watching the stack contents, evaluating any expression in the current running context...

Subroutines

The Subroutines are the interpreter functions associated to the corresponding Gambas functions like Sin, Left, Stat, etc. or operators like +, -, *, &, etc.

Component Interface

The Component Interface is a set of routines and services used by the components to communicate with the interpreter.

The interpreter's internals are hidden that way.

Component Loader

The Component Loader is the part of the interpreter that loads components shared libraries, gives them access to the Component Interface, and that publishes their interface to the other components.

Native classes

The Native Classes are classes that can be used without loading any component.

They are integrated in the interpreter, and can be looked upon as a part of the Gambas language.

Components

Components are shared libraries that are loaded at run time by the interpreter.

They can contain new classes and hook routines such as event loop management, shell arguments analyze, etc. They can publish a set of routines as an interface to other components also.

Components can be written in Gambas too. The archiver generates them as Gambas executables from Gambas projects marked as "component projects".