OK, this happened to me; no idea why. Searched the site for past experiences, applied all recommendations. Still happened on XP and Windows 7.
With no error report it has taken 4 days to find out that one line in 80,000 was causing the problem; following line
Global AIInfoCurrentlyActiveStat : AIInfoCurrentlyActiveStat = AddStat("AIInfo","AIInfo Active This Frame", 0, 0.0, 1, 0, 0)
This turned out to be no different to many identical lines performing a basic UDT array insertion function call using the following UDT:
Type StatType
Label$
Group$
Text$
Val#
Int
ShowVal
ShowInt
Flags
Endtype
By creating a separate project with the problematic line UDTs, the error could not be reproduced.
`Core_Statistics.dba
`======================
#CONSTANT STAT_WARNING 8
Type StatType
Label$
Group$
Text$
Val#
Int
ShowVal
ShowInt
Flags
Endtype
SetupStats()
Global AIInfoCurrentlyActiveStat : AIInfoCurrentlyActiveStat = AddStat("AIInfo","AIInfo Active This Frame", 0, 0.0, 1, 0, 0)
Print "Done creating "; Stats(1).Label$ + " statistic"
Wait Key
End
//==================================================
Function SetupStats()
Global Dim Stats(0) as StatType
EndFunction
//==================================================
Function AddStat( sGroup$, sLabel$, iShowVal, fDefVal#, iShowInt, iDefInt, iFlags)
Array Insert At Bottom Stats() : n = Array Count(Stats())
Stats(n) = Stats(0)
Stats(n).Int = iDefInt
Stats(n).Val# = fDefVal#
Stats(n).Label$ = sLabel$
Stats(n).Group$ = sGroup$
Stats(n).ShowInt = iShowInt
Stats(n).ShowVal = iShowVal
Stats(n).Flags= iFlags
Endfunction n
//==================================================
Function StatExist(i)
If i > 0
If i <= Array Count(Stats())
ExitFunction 1
Endif
Endif
Endfunction 0
//==================================================
Function SetStat( S, i, f# )
Stats(s).Int = i
Stats(s).Val# = f#
Endfunction
//==================================================
Function SetStatText( S, t$ )
Stats(s).Text$ = t$
Endfunction
//==================================================
Function StatText$( S )
s$ = Stats(s).Text$
Endfunction s$
//==================================================
Function Stat$( iStat, iDec )
If StatExist(iStat)
s$ = Def$( Stats(iStat).Label$ , "Statistic " + Str$(iStat) )
s$ = s$ + ": " + Stats(iStat).Text$
If Stats(iStat).ShowInt
s$ = s$ + " | " + Str$( Stats(iStat).Int )
Endif
If Stats(iStat).ShowVal
s$ = s$ + " | " + Str$( Stats(iStat).Val#, iDec )
Endif
Else
s$ = "Undefined Stat [" + Str$(iStat) + "]"
EndIf
Endfunction s$
//==================================================
Function Def$(s$, sDefault$)
if s$ = "" Then s$ = sDefault$
EndFunction s$
I'm posting this experience as it might lead to a clue later on, but right now I have no idea what is wrong with the compiler or this code.