On 5/15/22 08:27, SvGaming wrote: > I am so confused right now. It works if that code is the main function. > But in the full program that is only one of the functions and is not the > main function.
Could it be that the main() function exits before calling that other function?
You can sprinkle simple writeln calls to figure out exactly where it goes wrong:
void main() { writeln("entered main"); writeln("before calling foo"); foo(); writeln("exiting main"); } Ali