doc • compat

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 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.

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

The following information is known as a "Trick" and is only reccommended 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.
Now your application will "Run" on any version of gambas from 3.8 upwards.

If it 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.

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 will load perfectly fine into a newer Gambas.

And vice versa, a Gambas 3.15 project will load into an older Gambas IDE apart from one exception...

If you happen to have an early version of Gambas 3.15 or a source that has been saved with one of these versions and it has a CurrentArgument setting in it's .project file from the IDE saved then when attempting to load the older IDE will error complaining about a Type error.
This is due to the CurrentArgument setting changing format from a number to a list of strings. This has now been fixed and is unlikely you should find this problem but if you do simply load the .project file into a text and remove the CurrentArgument line.

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 recognise.