ScriptBasic:UsersGuide 6.1

From ScriptBasic
Revision as of 02:56, 8 December 2007 by John Spikowski (talk | contribs) (added note about using the full path with scriba when using the -K option)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


6. Compiling BASIC program to EXE

6.1. BASIC to EXE compilation technical details

[<<<] [>>>]

Under Windows and Linux an executable file is loaded into the system without caring too much the length of the file. This is the feature that let viruses attach themselves to executable file under Windows. When ScriptBasic is started with the option `-E' the interpreter makes a copy of the executable of itself and appends the compiled intermediate code after the executable code. Finally it prints the eleven characters string SCRIPTBASIC and a four byte file byte offset pointing after the end of the executable part of the file.

When the interpreter starts first it check if the last 15 bytes start with the string SCRIPTBASIC. If it does not then the interpreter continues in normal operation processing the command line parameters. However if the last 15 bytes start with the string SCRIPTBASIC then the executable is a ScriptBasic generated executable and it loads the code from the executable starting at the byte offset specified by the last four bytes of the file.

Under Linux, use the full path to scriba when using the -K option to build a standalone executable. Under Windows the full path isn't required for scriba.

/usr/bin/scriba -Ko standalone_program_name pgm.bas

[<<<] [>>>]