(* Following nil stops the program. The program ends with status 2, after the procedures registered with Rt.atExit, so that what it wrote is out. *) module StopNil; import Out, Rt; type Cell = record next: ^Cell; v: I64; end; proc bye; begin Out.str("bye\n"); end; proc main*; var c: Cell; begin _ := Rt.atExit(bye); c.v := 1; Out.str("before\n"); Out.int(c.next^.v); end; end StopNil.