I think specifically for writefln it needs to grab module constructors from the initialization, to set up the output stream. The GC and typeinfo would be important for a longer example. You might also want to do something similar at the end of C++'s main with Runtime.terminate().