1) Documentation bug in http://digitalmars.com/d/dll.html case DLL_PROCESS_DETACH: printf("DLL_PROCESS_DETACH\n"); std.c.stdio._fcloseallp = null; break; 2) in the explanation below it says for the DllMain: f std.d.stdio._fcloseallp to null. If this is not set to null, 3) The difference is the std.d. and std.c.