# General Default Termination Handling

When a Fortran Console, Fortran QuickWin, or Fortran Standard Graphics application terminates execution, either by normal termination or due to a severe error or exception, the following actions are taken by the Fortran run-time system:

- Any Open files are closed and the requested `DISPOSITION` operations are performed.

- With a QuickWin application, any open QuickWin windows are closed.

- The C run-time `exit()` routine is called with the status code to return to the operating system. The C run-time `exit()` routine will call the Windows API routine ExitProcess to terminate the process. (See crt0dat.c in the C run-time sources).

In a Fortran DLL or Fortran Windows* application, any unhandled I/O programming errors will cause the following actions:

- Any Open files are closed and the requested `DISPOSITION` operations are performed.

- The C run-time `exit()` routine is called with the status code to return to the operating system. The C run-time `exit()` routine will call the Windows API routine ExitProcess to terminate the process. (See crt0dat.c in the C run-time sources.)

Any unhandled exceptions that occur in a Fortran DLL or Fortran Windows application will have application dependent behavior. Since there is no Fortran default handler present, the behavior depends on what you provide for a handler. If you do not explicitly provide a handler, the default mechanisms provided in your main program will determine the behavior. In a Fortran Windows* application, the C run-time system will terminate the application.

Parent topic: Advanced Exception and Termination Handling