Functions that are used like this, work...
LOCAL myb%= init_myb(100)
but...
GLOBAL myb%= init_myb(100)
... are never called, no error either?
Whatever Gernot says I never initiate a variable with a function, no matter what :-)
They should be called. But! Before the main starts. They might not STDOUT or DEBUG messages.
I tested and the correct value was assigned.
Hmm, its definitely not working with one of my functions... I'll try to create a better reproducible error listing.
OK, 2 files "test2.gbas" and "testlib.gbas"...
LOCAL a% = test()
GLOBAL b% = test()
//b% = test() // Unremark me to see it working
DEBUG "a%="+a%+" b%="+b%+"\n"
and...
TYPE myType
a#[]
ENDTYPE
GLOBAL myArr[] AS myType
FUNCTION test%:
LOCAL b AS myType
DIMPUSH myArr[], b
l% = LEN(myArr)-1
RETURN l%
ENDFUNCTION
Run to see error.
This is basically an abstraction of my code, I think it could be narrowed down a little further though.
a=1, b=2 - fine?
With remark in place, "a%=1 b%=0" for me?
BTW I'm using version 9.040
Ahhh - Try V10 :)
Ooh ran out of time today, I'll give a wee go 1st thing tomorrow. ;)
It works in V10 - whether in 1 file or multiple ones :)
OK, confirmed, this has been fixed in the current V10 beta! =D