2. Embedded QUEL for C : C Variables and Data Types : Variable and Type Declarations : Compiling and Declaring External Compiled Forms -UNIX only
 
Share this page                  
Compiling and Declaring External Compiled Forms -UNIX only
You can precompile your forms in VIFRED. This saves the time that would otherwise be 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
The C compiler usually returns warning messages during this operation. You can suppress these, if you wish, with the -w flag on the cc command line. 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, you must declare it to EQUEL with the following syntax:
extern int *formname;
Syntax Notes:
The formname is the actual name of the form. VIFRED gives this name to the variable holding 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 the formname as an argument, except for addform, you must dereference the name with #.
The extern storage class associates the object with the external form definition.
Although you declare formname as a pointer, you should not precede it with an asterisk when using it in the addform statement.
The following example shows a typical form declaration and illustrates the difference between using the form's object definition and the form's name.
## extern int *empform;
## addform empform;     /* The global object */ 
## display #empform; 
##   /* The name of the form must be dereferenced */ 
##   /* because it is also the name of a variable */