Odd GLOBALS behaviour?
Malcolm Perrior <[email protected]>
| Newsgroups | gmane.comp.lang.4gl.aubit.general |
|---|---|
| Message-ID | <A338ECC4DD46BC4B8B313F6AACEEC1E302090425@ukhqexchange2.Foresters.co.uk> |
Or have I not set some variable? I recall something about global persistence across links but can't remember the context. NB this is under Ubuntu using an informix db and standard 4GL What we have is: A ".a" library built from several 4GLs in path "<path1>/<path2>/<path3>/base_lib/". All the 4GLs in here refer to ../../globals.4gl. The makefile also refers to that globals.4gl A program built from a single 4GL in "<path1>/<path4>/<path5>/program.4gl". The 4GL points to the same globals as the library, using "../../<path2>/globals.4gl" (as does its makefile). The globals file defines a global variable "prog_name". When the program runs, it calls a get_general_variables() function in one of the library 4GLs which uses arg_val(0) to get the program name and populate the global. (Set font to COURIER to see the below diagram properly) <path1> | |------/<path2>/ | | |--globals.4gl | | | |-------/<path3>/ | | | /<base_lib>/ | |--lib_file_1.4gl | |--lib_file_2.4gl | |------<path4> | | | |------/<path5>/ | |--program_source.4gl The program 4GL also contains a "WHENEVER ERROR CALL get_error_action"; this refers to a function in a second library 4gl (in the same library path), which is called if anything untoward happens (NB it refers to the same ../../globals.4gl) This works on our current HP-UX host running informix 4gl. Under the linux proof-of-concept I'm running, the prog_name variable appears to be unset in the case of an error. I've proved this by inserting "DISPLAY prog_name" statements in each of the modules at appropriate times; it's there in the library 4GL that sets it when the get_general_variable() function is called, it's there in the program 4GL after that call, but if I force an error it is NULL in the error handler code. Do I dimly recall that there's something I have to do to make global variables persistent in a4gl? Malcolm Perrior Database Administrator T 020 8628 3618 Foresters Foresters House, 2 Cromwell Avenue Bromley BR2 9BF foresters.com ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Aubit4gl-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss