4. Embedded QUEL for Fortran : Fortran Variables and Data Types : Variable and Type Declarations : Compiling and Declaring External Compiled Forms - UNIX
 
Share this page                  
Compiling and Declaring External Compiled Forms - UNIX
You can precompile your forms in 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 C. VIFRED prompts you for the name of the file with the description. After the file is created, you can use the following cc command to compile it into linkable object code:
cc -c filename
This command produces an object file that contains a global symbol with the same name as your form.
Before the EQUEL/FORMS statement addform can refer to this global object, use the following syntax to declare it to EQUEL:
extern int *formname;
Next, for the program to access the external form definition, you must declare the formname as an external symbol:
external formname
Because this second declaration is not an EQUEL declaration, do not precede it with the ## mark. Its purpose is to inform the linker to associate the global symbol in the compiled form file with the object of the addform statement.
Syntax Notes:
formname is the actual name of the form and appears as the title of the form in EQUEL/FORMS statements other than the addform statement. It is also the name that VIFRED gives to the global object in the compiled form file.
In all EQUEL/FORMS statements other than the addform statement that expect a form name you must dereference formname with # so that it is interpreted as a name and not as an integer variable.
The EXTERNAL statement associates the external form definition with the integer object used by the addform statement.
##  integer empfrm
    external empfrm

C  The global object
##   ADDFORM empfrm
C  The name of the form must be dereferenced
C  because it is also the name of a variable
## DISPLAY #empfrm