So let me reiterate the code I propose:

```D
extern (C) int main(int argc, char **argv)
{
    auto result = _d_run_main(argc, argv, &_Dmain);
    if (fflush(stdout) != 0)
    {
        fprintf(stderr, "Failed to flush stdout, error code: %d\n", errno); // unchecked
        result = 1;
    }
    return result;
}
```

Is that at the appropriate time (i.e. all flushes etc will happen after main as far as I understand)?