PDA

View Full Version : Global Variable Handle error.



colw
7-Dec-2022, 07:28 PM
Hi all,

In the process of migrating to 64 bit I came across a problem whereby "Global_Variable Handle" declarations are not always initialised to '0'. Has anyone else noticed this?

For example the code:

Global_Variable Handle ghtest1
Showln "1 = " ghtest1

Should display "1= 0".. but it does not always. Below are the results of some simple code where there are 5 declarations as above done on 32 bit and then 64 bit.

//These are results compiled and run as 32 bit
1= 0
2= 0
3= 0
4= 0
5= 0

//These are the results from the same code compiled and run as 64 bit
1= 0
2= 0
3= 6359736094333875520
4= 6359736094333875520
5= 6359736094333875520

Any ideas?

Col.

Samuel Pizarro
8-Dec-2022, 07:49 AM
DF 20: Something is really wrong with bigInt global_variables (dataaccess.com) (https://support.dataaccess.com/Forums/showthread.php?67621-DF-20-Something-is-really-wrong-with-bigInt-global_variables&highlight=global_variable)
Global_Variable BigInt Initial value problem (dataaccess.com) (https://support.dataaccess.com/Forums/showthread.php?67620-Global_Variable-BigInt-Initial-value-problem&highlight=global_variable)

What version are you ? 20.0 or 20.1 ? I was hoping that this could have been fixed.

colw
8-Dec-2022, 09:23 PM
Hi Samuel,

Version from Studio 'About' is is :-

DataFlex 2022 Studio 20.1 - 20.1.34.78


Runtime Version: 20.1.34
Package Version: 20.1.3
FMAC Version: 20.1.111
Javascript Engine Version (MASTER): 20.1.34.78
Javascript Engine Version (WORKSPACE): 20.1.34.78
Platform: 64-bit
Database driver(s): DATAFLEX, ODBC_DRV (20.1.34.10)

Col.

Samuel Pizarro
8-Dec-2022, 09:45 PM
So. Not fixed yet !

:(

colw
8-Dec-2022, 10:22 PM
Samuel,

I checked out your links and it seems like it has been there a while. Thanks, at least I know how to work around.

I dont know if anyone from DataAccess is reading this but a little bit of testing shows that for me it seems to be linked to the StdAbout.pkg

The following code...

Object oClientArea is a ClientArea

//Global Handle test******************
Global_Variable Handle ghtest1
Showln "1= " ghtest1

Use StdAbout.pkg

Procedure Activate_About
Send DoAbout "" "" "" "" ""
End_Procedure

End_Object

The above works fine and displays '1= 0' but .......

Object oClientArea is a ClientArea

Use StdAbout.pkg
//Global Handle test****************
Global_Variable Handle ghtest1
Showln "1= " ghtest1


Procedure Activate_About
Send DoAbout "" "" "" "" ""
End_Procedure

End_Object


shows '1= 6359736094333875520'

In fact any Global_Variable Handle declared after the Use StdAbout.pkg has an incorrect value. Weird but true :-).


Col.

Ian Smith
9-Dec-2022, 04:39 AM
Hi Col

I'm see the issue with uninitialised global handles even before Use StdAbout (DF 20.1.34)

Object oClientArea is a ClientArea

Global_Variable Handle gh1
Global_Variable Handle gh2
Global_Variable Handle gh3
Global_Variable Handle gh4
Global_Variable Handle gh5
Global_Variable Handle gh6
Global_Variable Handle gh7
Global_Variable Handle gh8

Showln "1 = " gh1
Showln "2 = " gh2
Showln "3 = " gh3
Showln "4 = " gh4
Showln "5 = " gh5
Showln "6 = " gh6
Showln "7 = " gh7
Showln "8 = " gh8

Use StdAbout.pkg
Use General_Testing.vw

Procedure Activate_About
Send DoAbout "" "" "" "" ""
End_Procedure

End_Object



15822

Vincent Oorsprong
12-Dec-2022, 03:17 AM
Colin,

First I would encourage you to not use global variables but if you do so it is better to initialize them and not expect initialization by default. There even is - although obsolete - a command named CHAIN that passes all global (integer) variables from the starting program to the chained-to program.