4D v16.3

Compiler window

Home

 
4D v16.3
Compiler window

Compiler window  


 

 

To display the compiler window, select the Compiler... command in the Design menu. You can also click on the “Compiler” button of the 4D tool bar or choose the Compiler command in the associated menu:

Note: These commands are disabled if the database does not contain at least one method.

This window is used for launching the compilation of the database or checking the syntax of the methods. In addition, buttons can be used for generating/regenerating database typing methods, erasing the compiled code, displaying or hiding the warnings, and accessing the Database Settings directly.

Note: Database compilation requires an appropriate license. Without this license, it is not possible to carry out a compilation (the Start Compilation command and the Compile button are disabled). Nevertheless, it is still possible to check the syntax and generate typing methods.

The Compiler button causes the immediate launching of the database compilation process. It is the exact equivalent of the Start Compilation command in the Design menu.If the database has already been compiled, the new code compiled will replace the former.
Initially, different passes are carried out for checking, typing and initialization, in accordance with the configuration set on the Compiler page of the Database Settings window.

If no errors are detected, the actual compilation begins. If errors are detected, the process is stopped and the information area of the window displays the method names and line numbers concerned in a hierarchical list:

Double-click on each error detected in order to open the method concerned directly in the 4D Method editor; the line containing the error is highlighted and the type of error is displayed in the syntax area of the window. The Previous Error / Next Error commands of the Method menu of the editor allow you to navigate among the lines containing errors.

Note: The number of errors found during your first compilations may be daunting, but do not let this put you off. You will soon discover that they often spring from the same source, i.e., non-compliance with certain database conventions. The compiler always provides a precise diagnosis of the errors in order to help you correct them.

The Check Syntax button starts the execution of the syntax-checking phase. At the end of checking, any errors detected are listed in the information area. You can double–click on an error line in order to display the corresponding method.

This option is the only one available if you do not have a suitable license to allow the compilation of applications.
Syntax checking can also be launched directly using the Check Syntax command associated with the “Compiler” button.

The Generate Typing button creates (or updates) the typing “compiler methods.” Compiler methods are project methods that group together all the variable typing declarations, process and interprocess arrays, as well as the local variable declaration methods. These methods, when they exist, are used directly by the compiler during code compilation, which accelerates compilation. If these methods already exist, their contents are updated.

These methods, whose names must mandatorily begin with “Compiler_”, are generated by 4D. You can set the default name for each of the 5 compiler methods in the Database Settings (see Compiler Methods for...). The compiler methods generated and maintained by 4D automatically have the “Invisible” attribute:

Only the necessary compiler methods (i.e., those for which items already exist in the database) are generated. 

The information area indicates any errors found during method creation or updating. Double-clicking on an error line causes the method and line concerned to be displayed in the Method editor. 

For more information about typing methods, refer to the Compiler chapter of the 4D Language Reference manual.

The Clear compiled code button deletes the compiled code of the structure file. When you click on it, all of the code generated during compilation is deleted. The size of the structure file will be reduced accordingly if you carry out a compacting operation (see GET STYLE SHEET INFO). 

The Restart Compiled command of the Run menu is then disabled and the “Compiled Database” option is grayed out in the open database dialog box and in the menu associated with the Open button. 

Note that generated compiler methods are not deleted by this command .

Warnings are specific messages generated by the compiler when it checks the syntax. These messages are intended to draw your attention to statements that might lead to execution errors. They do not prevent compilation. For more information about warnings, refer to Warnings

Depending on circumstances and the programming style used, these warnings may be more or less relevant. You have an option for displaying or hiding the warnings in the information area of the compiler window.

When this option is checked, the warnings (if any) are displayed in the window, after the other error types. They appear in italics and are followed by their warning number:

Double-clicking a warning opens the corresponding method.

You can selectively disable certain warnings during compilation by inserting the following into the code of a 4D method:

  //%W-<warning number>

Warning numbers are now specified at the end of each message in the list of compilation errors. For example, to disable the following warning: 

1: Pointer in an array declaration (518.5)

... you just need to write the following comment in a 4D method, preferably a COMPILER_xxx method (method compiled first):

  //%W-518.5

You use the button to display the Compiler page page of the Database Settings. Options specified in this dialog box only apply to the open database. 

 
PROPERTIES 

Product: 4D
Theme: Compilation

 
HISTORY 

 
TAGS 

warning

 
ARTICLE USAGE

4D Design Reference ( 4D v16)
4D Design Reference ( 4D v16.1)
4D Design Reference ( 4D v16.3)