PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: fraser-portwood on April 15, 2004, 05:34:31 PM

Title: Declare Statements
Post by: fraser-portwood on April 15, 2004, 05:34:31 PM
Am I doing something wrong, I am adding DECLARE FUNCTION statements in my General Editor, when I compile my Declare Statement show both in the DECLARE.inc and the FORM.inc files

Fraser Portwood
Title: Declare Statements
Post by: TechSupport on April 15, 2004, 07:04:27 PM
Hi Fraser,

No need to worry. FireFly is doing this behind the scenes and there is a very good reason for it. The PowerBASIC compiler does not handle "forward referencing". This means that all functions, Types, Unions, constants, etc... must be declared before they can be referenced in code. This would mean that FireFly would have to know which Form file to Include before which Form file. Likewise for Modules.

To deal with this issue, FireFly pre-parses all of the Project's files during the code generation and moves (actually copies) things to the Declares file. The Declares file is Included in the Main source file before the Forms and Modules thereby allowing the Forms/Modules to be included in the Main file in any sequence.

This was a difficult area to deal with during the programming of FireFly but it does work pretty well. The fact that something is declared twice does not impact your application's size or speed.