DECLARE GLOBAL / EXTERN
Kenneth Brody
kenbrody at bestweb.net
Fri Jul 27 10:42:11 PDT 2007
Note that it is perfectly acceptable to have DECLARE EXTERN in the
main processing, and DECLARE GLOBAL in the CALLed table, as long as
you don't use the variable until you call the table that actually
defines it with the DECLARE GLOBAL. I do this all the time.
Example:
===== Main processing:
::end:
@entsel::show "\{T} - test declare extern/global combo":
::end:
::declare extern MyVariable:
@keyT::' MyVariable = "from input":
::call "called":
::mesgbox "Back in input. MyVariable is '" & MyVariable & "'":
::end:
===== Called processing:
::declare global MyVariable(30,*):
::mesgbox "In called processing":
::MyVariable = "set in called":
::end:
=====
This will run just fine. However, if you uncomment the assignment in
the main prc, you will get the error when the CALL is executed, and
the variable will not take on the (30,*) setting.
In more complex library scenarios, I often have an "init" table with
all of the DECLARE GLOBALs needed by the library, in addition to any
required initializations, which gets called prior to using any of
the library routines themselves.
--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:ThisIsASpamTrap at gmail.com>
More information about the Filepro-list
mailing list