How to Declare 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, 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 Embedded SQL/FORMS statement addform can refer to this global object, it must be declared in an Embedded SQL 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
exec sql begin declare section;
formname: Integer;
exec sql end declare section;
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;
Note:
• 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 Embedded SQL/FORMS statements.
• The import_object pragma associates the object with the external form definition. To use this pragma, the package must be issued in the outermost scope of the file.
The example below 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
exec sql begin declare section;
empform: Integer;
exec sql end declare section;
pragma import_object( empform );
end Compiled_Forms;
...
with Compiled_Forms; use Compiled_Forms;
...
exec frs addform :empform; -- The imported object
exec frs display empform; -- The name of the form
...