A procedure can only be called if it can be resolved from the point of insertion of the procedure call. Because duplicate procedure names are allowed in HDevelop, understanding the order of resolution is very important. The resolution order determines which procedure is used if several procedures of the same name exist. For example, the imported procedure xyz.hdvp takes priority over the local procedure xyz.hdvp.
Procedures are resolved based on their name only and not on the matching of the signature. If the resolved procedure has a different signature, such like different number and/or types of parameters, the call will be invalid.
A procedure call looks for a procedure of the given name in the following order:
HDevelop looks for imported procedures (section “Procedure Locations”). Note that for several import statements that contain procedures of the same name, the last import call has priority.
If no imported procedure is found, the context of the calling procedure is significant for the procedure resolution. The context depends on the type of the calling procedure:
HDevelop looks for external procedures (section “Procedure Locations”) in the following order:
hdevelop -external_proc_path:<path name(s)>
The tool tip of a procedure call reveals the location of the resolved procedure.
As an example, we look at a program with three local procedures. Two procedure directories are defined (disregarding the standard procedure path).
+ C:/Users/Public/ | +--+ example.hdev | | | +--- main | +--- init | +--- compute_results | +--+ procedures/project/ | | | +--- init.hdvp public | +--- local.hdvp private | +--- setup.hdvp public | | | +--+ visualization.hdpl library | | | +--- init private | +--- process private | +--- setup public | +--+ procedures/common/ | +--- config.hdvp public
| In procedure | a call to | resolves to |
| main | init | init (local procedure in example.hdev) |
| project/visualization.hdpl/setup | init | project/visualization.hdpl/init |
| common/config | init | project/init |
| main | process | - |
| project/visualization.hdpl/init | process | project/visualization.hdpl/process |
| compute_results | local | - |
| project/setup | local | project/local |