4GL Debugger with global variables used by C code
Posted in 1997
We have a program which is compiled from a 4GL source module and a C module. There is a global variable declared as "extern" in the C's header file, as well as being declared in the GLOBALS of the 4GL. This compiles and runs fine as far as that is concerned, BUT when using the debugger, we are forced to compile a standalone executable (the debugger program), which then uses the 4gi file containing the 4GL code. Problem 1: We get unresolved symbol errors, since the variable is declared externally. Solution to Problem 1: Declare the variable within the C code. This appears to work fine when compiling the entire thing, since apparently the 4GL compiler is "smart" enough to check for previous declarations when parsing the GLOBALS statement. However, when running this through the debugger, we have apparently created 2 separate variables (one local to the C module and the other local to the 4GL.) This was "proven" by the fact that after calling the C function in the debugger, the "global" variable was still NULL, while inserting display statements in the usual executable showed that the variable actually contained what was expected. (Unacceptable) solution to problem created by "Solution to Problem 1": Run the program with display (or other logging) after each call to a C function, and then use the LET statement in the debugger to make the 4GL "pseudo-global" variable act as if it were really global. Is there a better solution? (Besides the obvious "avoid global variables" I'd rather not rewrite the entire program). Did my description make sense? I'll be glad to elaborate if need be. This happened with Informix 7.21 running on HP-UX 10.0. Many thanks in advance -- - Danny Wright danwright@bigfoot.com "If you get confused, then listen to the music play." - Robert Hunter "Confusion will be my epitaph" - Pete Sinfield