# CHAPTER 8: Executable Builder

## 8.1 The 4GL Executable Builder

The `4GL Executable Builder` is a facility that allows the user to build customized executables to run 4GL applications. A customized executable consists of zero or more terminal definitions and zero or more linked applications compiled as read only data and linked to a copy of the 4GL runtime executable. Read only data is part of the executable's text space and is automatically in memory when the executable is invoked. A customized executable can be invoked to run any application linked to it on any terminal whose definition has been linked to it without having to go to the database to get the information. Also, because the customized executable is a copy of the 4GL runtime executable it can also be used to run applications on terminals that have not been linked to it as read only data.

Building a customized executable has several advantages:

- The initial startup time for running applications is reduced because they are already in memory.
- Memory usage for multiple users is reduced because only one copy of the terminal definitions and linked applications are kept in memory no matter how many times the executable is invoked.
- Application developers can package their applications for end users into an executable and remove the need for a 4GL application database.

The `4GL Executable Builder` is invoked by typing the following command:

    emp4bldx

(There are several options to this command which are described in the "Manual Pages" of the Empress 4GL Administrator's Guide.) The `4GL Executable Builder` will prompt the user to enter a name for the customized executable to be built in the user's current working directory.

    Enter name of executable: exec1

The user is then prompted to enter the names of terminal definitions to be linked to the executable.

    Enter name of terminal: vt100

    Enter name of terminal: vt220

    Enter name of terminal:

(A <Return> by itself is used to tell the `4GL Executable Builder` that you are finished entering data.) The user is then prompted to enter the name of a database followed by names of linked applications from that database to be linked to the executable.

    Enter name of database: userdb

    Enter name of Application: applic1

    Enter name of Application: applic2

    Enter name of Application:

    Enter name of database:

(Applications from different databases can also be linked to the executable). The `4GL Executable Builder` then creates the appropriate C data files containing read only data and compiles and links them along with the 4GL runtime libraries to make a customized executable.

    Creating files ........

    Compiling .............

    Linking ...............

The application `applic1` can now be run by simply entering the name of the executable:

    exec1

Application `applic1` was chosen because it was the first one entered above.

If application `applic1` needs a default user database then enter:

    exec1 -d userdb

If you wish to run a different application at startup you may do so by entering:

    exec1 -d userdb -a applic2