Re: Rare problem with global variable value
Mike Aubury <[email protected]> Fri, 10 Jul 2020 19:22:50 +0100
| Newsgroups | gmane.comp.lang.4gl.aubit.general |
|---|---|
| Message-ID | <CAGAq4WEUUHNz17zRowBuuurfSWAUR_LgbnCXw72df_GSEzRSeA@mail.gmail.com> |
The chances are they you've got the global variable defined in two files. Normally - you should have *one *definition within a GLOBALS .. END GLOBALS and then you reference that definition from a GLOBALS "filename.4gl" In Aubit4gl - we try to initialise globals (in informix4GL - c-compiler version - they are not initialised) - but if its defined in two files - it will get initialised in both (when any function in that module is called). If you've got it in two files, and you can't "fix" it - try compiling with export NOGLOBALINIT=Y and recompile your 4gls, see if that fixes it. On Fri, 10 Jul 2020 at 18:21, Sergio Szychowski <[email protected]> wrote: > Hello, > > I have a global variable type int in a module xxx.4gl, which takes value > inside this module, but when I invoke a function > Inside the yyy.4gl module, which uses the value of this variable, it > appears with a value of 0. > the variable is defined in both modules as int and global. > > Something I observed is that in the xxx.c and yyy.c a block 'c' appears at > the beginning where it initializes the > variables that are global. This should happen only once, and immediately > after the entry point to 4ae. Or maybe it shouldn't happen automatically. > > Thanks in advance > > Best regards > > > _______________________________________________ > Aubit4gl-discuss mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss > _______________________________________________ Aubit4gl-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss