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

Compatibility between versions

Backward compatibility with older versions of Gambas

Can an application compiled on a newer version of gambas run on an older one?

Maybe, depending on the code you have used but backward compatibility is not enabled by default.

Due to how Gambas works if you have used specific code that can only work in say Gambas 3.15 because before that it did not exist then sadly no your application will not run on a lesser version of Gambas unless you change the newer code to the older ways.

It is possible and even likely however that your application will not have such code, and may well work, just not by default.

The best way to see if your program works on an older version of gambas is to use an older gambas and try it

The following information is known as a "Trick" and is only recommended if you know what you are doing.

A lesser/older version Gambas will fail to load the application and report a bytecode mismatch error by default,
advising the user to upgrade Gambas.

Unless you set a GB_PCODE_VERSION environment variable in the projects Properties.
So if for example you are using Gambas 3.15 you can open the Project Properties (Ctrl-i),
click the Environment tab,
then press the + Add button.
Enter GB_PCODE_VERSION for Variable and 3.8 for Value.

For newer versions of Gambas the option is in the Project properties (Options / Force bytecode version)

Note: the ONLY available versions for this setting are 3.8, 3.15 and 3.18
(written Oct, 2022)

Now your application "is able to run" on any version of gambas from 3.8 upwards. Meaning the interpreters will not just report a bytecode error and exit but will attempt to run the program.

Important:
If this will work or not is up to you and the code you have used. If your application is failing on an older Gambas you will have to check the Release Notes (the "What's New" parts of each version would be a good place to look) and see what code you may have used and what you can change to make your application backward compatible.
Alternatively (and what I do) is to use another partition or a VM to have a system with an older gambas installed on it to test a program and use the IDE debugger to track down any compatibility issues.


Forward compatibility with a newer versions of Gambas

Can an application compiled on a newer version of gambas run on an older one?

Most likely with very few exceptions.

An application compiled on an older version of Gambas Will run on a newer Gambas without the interpreter giving a bytecode mismatch error.

There are however a small amount of changes you may have to account for.
For example if a control has a property removed or it's name changed then your program will need to account for it.
Every effort has been made by the developer to ensure this does not happen but some things can become obsolete after time.


A note about loading a projects source code into the IDE

A Gambas project made using an older version of the IDE should load perfectly fine into a newer Gambas.

And vice versa, a newer Gambas project will load into an older Gambas IDE
BUT be warned...

Loading and editing a project with an older IDE version can cause problems when the settings save, you can loose Debbugger argument settings and some other project settings.
This is because the newer version of gambas is built to handle and convert older project settings but the older gambas versions cannot handle newer settings (and never will as only the new gambas version ever changes) so some project settings could be lost.

Also read the above info about backward compatibility as a project saved with a newer version Gambas may have code written specific to that version and above that the older version will not recognize.


Useful tricks

Use TRY and check for an ERROR to see if newer code will work on the current version of gambas or not.
Eg.

Try Fmain.MinWidth = 400
  If Error Then
    ' This gambas version does not support Form.MinWidth so we will have to handle it ourselves.
    bUseWindowLimitter = True
  Else
    ' This gambas version does support Form.MinWidth
    bUseWindowLimitter = False
  Endif