Trying to get back up to speed. OK I've reduced this to its base error... I think?
Well, a program that used to compile and run fine, now crashes...
I have a function that loads some data when a filename is passed to it.
If I use the following in the main program...
GLOBAL lastfont = addfont("fnt_test")
The program crashes when run, without a compile error.
So I reduced the "addfont()" code to one line that seemed to be causing the crash...
FUNCTION addfont: filename$ // Create a new font
INIOPEN filename$+".ini" <-------------------------- If I remove this line it does not crash?
ENDFUNCTION
As I said, this used to work, the .exe is still in the folder from the last v5.119 compiler and it runs. The latest compiler seems to be not allowing this?
This is due to the line
GLOBAL lastfont = addfont("fnt_test")
Never declare a variable and call a function to initialize it on the same line, break it into two lines:
GLOBAL lastfont
lastfont = addfont("fnt_test")
Right. GLOBAL a=function() is bad!
The code is getting called _before_ any GLBasic initialization is done, thus it breaks with some internal functions. INIOPEN is one.
OK, thanks for the quick heads up guys.
Some times I get a little carried away with all the various methods of manipulating types/vars GLB has... :whistle:
Possibly worth adding this to the syntax check parsing though, as it compiles fine?
Thanks again! :good:
your function return nothing :nana:
He removed everything until he found out where it crashed, that was the only line he could leave in there to still have the crash :)