5. Embedded QUEL for Ada : Ada Variables and Data Types : Variable and Type Declarations : Assembling and Declaring External Compiled Forms
 
Share this page                  
Assembling and Declaring External Compiled Forms
You can pre-compile your forms in the Visual Forms Editor (VIFRED). This saves the time otherwise required at runtime to extract the form's definition from the database forms catalogs. When you compile a form in VIFRED, VIFRED creates a file in your directory describing the form in the VAX-11 MACRO language. VIFRED prompts you for the name of the file with the MACRO description. After the file is created the file, use the following VMS command to assemble it into a linkable object module:
macro filename
This command produces an object file containing a global symbol with the same name as your form. Before the EQUEL/FORMS statement addform can refer to this global object, it must be declared in an EQUEL declaration section. The Ada compiler requires that the declaration be in a package and that the objects be imported with the import_object pragma.
The syntax for a compiled form package is:
##    package compiled_forms_package is
##        formname: Integer;
                          pragma import_object( formname );
##    end compiled_forms_package;
You must then issue the Ada with and use statements on the compiled form package before every compilation unit that refers to the form:
with compiled_forms_package; use compiled_forms_package;
Syntax Notes:
1. The formname is the actual name of the form. VIFRED gives this name to the address of the external object. The formname is also used as the title of the form in other EQUEL/FORMS statements. In all statements that use formname as the form title you must dereference the name with a # sign.
2. The import_object pragma associates the object with the external form definition. In order to use this pragma, the package must be issued in the outermost scope of the file.
The next example shows a typical form declaration and illustrates the difference between using the form's object definition and the form's name.
## package Compiled_Forms is
## empform: Integer;
        pragma import_object( empform );
## end Compiled_Forms;
        ...

with Compiled_Forms; use Compiled_Forms;
        ...

## addform empform; -- The imported object
## display #empform; -- The name of the form
        ...