Program units

[ Back ]

When you compile a program, two files are created: filename.exe (the executable file) and filename.sbe (a program unit file). Usually the sbe can be deleted, as it is also included in the executable file. But it is possible to stop the execution of a program and start executing another sbe. In that case the sbe of the external program is needed (at least for a while).

Sub routines and an array

procedure run sbe_filename$
args$[]
procedure include sbe_filename$


procedure run sbe_filename$

Stop execution of the current program and run an external (or included) program unit, sbe_filename.


args$[]

The string array args can be used for passing parameters between program units, as it remains untouched when a new program unit is executed.


procedure include sbe_filename$

With this compiler directive you can include external program units in your current program. This makes the resulting executable file independent of all sbe files. It is very important that every program unit is only included once in the entire program (usually in the unit that is to be launched first). You can even use a pure launcher for the entire program that gathers all the program units and creates a final executable. Ex:

rem A game.
include "main.sbe"
include "hiscore.sbe"
include "the_end.sbe"
run "main.sbe"


[ Back ]