[Gambas-user] Possibility to compile old bytecode

Benoît Minisini g4mba5 at gmail.com
Thu Jan 23 17:16:40 CET 2020

Le 23/01/2020 à 16:52, Christof Thalhofer a écrit :
> Hi,
> as I do a lot programming of production code for computers with older 
> Gambas versions (3.9, 3.11) I now have a big problem with "Bytecode too 
> recent" errors, as soon as I use the current dev version and later 
> version 3.15 and so on.
> Would it be possible to create a compiler flag to let gbc3 compile to 
> older bytecode?
> This would help me a lot because otherwise I had to keep up an older 
> Gambas version.
> If it is not possible or if it is a pain I would have to work with 
> virtual machines. This is not a big problem, but a bigger one would be 
> if I'd like to realize automatic deployment later on.
> Alles Gute
> Christof Thalhofer

If you know that you don't use new language feature, you can force the 
compiler to save a specific bytecode version with the GB_PCODE_VERSION 
environment variable. For example GB_PCODE_VERSION=3.8.

Beware that it "does not compile to older bytecode". You need an older 
compiler for that. So if you use it incorrectly, the interpreter will 
segfault, abort or have an undefined behaviour.

The better being not to use a development version for production code!

Benoît Minisini

More information about the User mailing list